Operating System - HP-UX
1748018 Members
3510 Online
108757 Solutions
New Discussion юеВ

Re: Root date not synchronized with user date

 
Naqiud
Advisor

Re: Root date not synchronized with user date

Hi Ashish,

when i set

# export TZ=mal-8
# echo $TZ

the date successfully change to faiznaq user id. but when i log out and login again, the date back to incorrect one.

so i set the the TZ at /etc/profile. but still, the date are not synchronized.

sigh..

AL_3001
Regular Advisor

Re: Root date not synchronized with user date

Add tne entry in .profile file in the root directory. Hope this will work... Let me know.
Naqiud
Advisor

Re: Root date not synchronized with user date

Hi Ashish,

still not working. i've added in .profile at root. still the same.
Yogeeraj_1
Honored Contributor

Re: Root date not synchronized with user date

hi,

First of all, determine the HOME directory of user "faiznaq":

grep -i faiznaq /etc/passwd

e.g.

SRV2: home/yogeeraj>grep -i yogee /etc/passwd
yogee:dEJ.1HPXbbiSU:301:102:,,,:/home/yogeeraj:/usr/bin/ksh
SRV2: home/yogeeraj>

Then, verify the .profile of the user

e.g.
SRV2: home/yogeeraj> cat /home/yogeeraj/.profile

Do you see anything in the .profile concerning the TZ environment variable?

(it may also be that this is being sourced from another file... you may wish to post the .profile here for further verifications)


revert
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Naqiud
Advisor

Re: Root date not synchronized with user date

Hi Yogeeraj,

this is user .profile.

===============================

N4000_1] /home/faiznaq > more .profile

# @(#)B.11.11_LR

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR
==============================

the problem is, all users under users group id is facing this problem. not only faiznaq's user id.

any ideas?
Matti_Kurkela
Honored Contributor

Re: Root date not synchronized with user date

A little bit of background:

When any user logs in, the system will start a shell for him/her, then the shell will execute a "system-wide" login script. If the user's shell is sh (the default), ksh or some other shell of the Bourne shell family, this login script is /etc/profile. If the user's shell is csh or tcsh, the system-wide login script is different: it will be /etc/csh.cshrc. The system-wide login script should set the TZ variable to the system's default value. In HP-UX, the default setting is read from file /etc/TIMEZONE.

All users must be able to read the /etc/TIMEZONE file. The file must contain a valid sh-style environment variable setting command, e.g.:

TZ=EET-2EETDST
export TZ

After the system-wide login script, the shell will check the user's home directory and execute a user-specific login script if one exists. For sh and ksh, this is named ".profile"; for csh and tcsh, there are two possible filenames: ".login" and/or ".cshrc".
These scripts can expand or override the settings of the system-wide startup scripts, and could change the timezone if the user wants to do that. But looks like your user's ".profile" is the default version, so the user has not made any changes like that.

What is the output of these commands?
ll /etc/TIMEZONE
cat /etc/TIMEZONE

Your TZ variable setting of "mal-8" looks non-standard. The standard timezone identifiers should be in UPPER CASE. According to the /usr/lib/tztab file of one HP-UX 11.11 machine, the standard setting for Malaysia should be something like "PST-8PDT". If you don't want to use the Daylight Saving Time feature, you should omit the PDT part and set the TZ variable to "PST-8". Using "mal" instead of "PST" may affect some applications that use the timezone information.

MK
MK
Yogeeraj_1
Honored Contributor

Re: Root date not synchronized with user date

Thank you Matti for your clear clarifications and posts from which i always learn a lot!

On top of th output of these commands:
ll /etc/TIMEZONE
cat /etc/TIMEZONE

can you also post your /etc/profile?

the .profile does not containing anything that can help us. Does all the users share the same HOME?


revert


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Naqiud
Advisor

Re: Root date not synchronized with user date

Hi,

yes! all user shared same HOME.

this is my /etc/profile

===============================

N4000_1] / > cat /etc/profile

# @(#)B.11.11_LR

# Default (example of) system-wide profile file (/usr/bin/sh initialization).
# This should be kept to the bare minimum every user needs.

# Ignore HUP, INT, QUIT now.

trap "" 1 2 3

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man

# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).

if [ ! -d /usr/sbin ]
then
PATH=$PATH:/sbin

else if [ -r /etc/PATH ]
then

# Insure that $PATH includes /usr/bin . If /usr/bin is
# present in /etc/PATH then $PATH is set to the contents
# of /etc/PATH. Otherwise, add the contents of /etc/PATH
# to the end of the default $PATH definition above.

grep -q -e "^/usr/bin$" -e "^/usr/bin:" -e ":/usr/bin:"\
-e ":/usr/bin$" /etc/PATH
if [ $? -eq 0 ]
then
PATH=`cat /etc/PATH`
else
PATH=$PATH:`cat /etc/PATH`
fi
fi
fi

export PATH

# Set MANPATH to the contents of /etc/MANPATH, if it exists.

if [ -r /etc/MANPATH ]
then
MANPATH=`cat /etc/MANPATH`
fi

export MANPATH

# Set the TIMEZONE

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
else
TZ=mal-8 # change this for local time.
# TZ=MST7MDT //default
export TZ
fi

# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# set term if it's not set

if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi

export TERM

# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
stty erase $ERASE

# Set up shell environment:

trap "echo logout" 0


# This is to meet legal requirements...

cat /etc/copyright

# Message of the day

if [ -r /etc/motd ]
then
cat /etc/motd
fi

# Notify if there is mail

if [ -f /usr/bin/mail ]
then
if mail -e
then echo "You have mail."
fi
fi

# Notify if there is news

if [ -f /usr/bin/news ]
then news -n
fi

# Change the backup tape

if [ -r /tmp/changetape ]
then echo "\007\nYou are the first to log in since backup:"
echo "Please change the backup tape.\n"
rm -f /tmp/changetape
fi

fi # if !VUE

# Leave defaults in user environment.

trap 1 2 3

===================================


N4000_1] / > ls -lrt /etc/TIMEZONE
-r--r--r-- 1 bin bin 19 Mar 2 2006 /etc/TIMEZONE
N4000_1] / > cat /etc/TIMEZONE
TZ=mal-8

=====================================

thanks everyone..




Dennis Handly
Acclaimed Contributor

Re: Root date not synchronized with user date

>all users under users group id is facing this problem.

If all your users are in the same timezone you need to fix your file /etc/TIMEZONE.

If they aren't in the same timezone, it is the responsibility of the odd users to edit their .profile and set TZ as they need.

Please provide the output of: date -u
Dennis Handly
Acclaimed Contributor

Re: Root date not synchronized with user date

It looks like someone tried to correct /etc/profile instead of /etc/TIMEZONE:
# Set the TIMEZONE
if [ -r /etc/TIMEZONE ]; then
. /etc/TIMEZONE
else
TZ=mal-8 # change this for local time.
export TZ
fi

Since /etc/TIMEZONE should exist, it won't go though the TZ=mal-8 path. Just edit /etc/TIMEZONE and you can remove this code from /etc/profile.

>MK: Using "mal" instead of "PST" may affect some applications that use the timezone information.

Affect? Do you mean in a bad way?
If MAL is the correct timezone name, then that's what it should be. (I would recommend upper case too.)