Re: Root date not synchronized with user date (273 Views)
Reply
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 1 of 22 (273 Views)

Root date not synchronized with user date

Hi,

do anyone ever face this problem? root date is updated. but not for user date. user and root date are not synchronize.
==========================================

N4000_1] / > date
Mon Mar 31 13:48:58 mal 2008
N4000_1] / > id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
N4000_1] / >
logout root
$ id
uid=116(faiznaq) gid=20(users)
$ date
Mon Mar 31 00:49:10 EST 2008

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

how i can update both and synch both?

thanks in advance.
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 2 of 22 (273 Views)

Re: Root date not synchronized with user date

Check the value of the TZ environment variable for both root and the user. Maybe the user lives in another time zone or has some other reason to use a TZ setting that does not match the system default.

MK
MK
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 3 of 22 (273 Views)

Re: Root date not synchronized with user date

what is TZ?

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

N4000_1] / > id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
N4000_1] / > date
Mon Mar 31 14:11:10 mal 2008
N4000_1] / > which date
/usr/bin/date
N4000_1] / >
logout root
$ id
uid=116(faiznaq) gid=20(users)
$ date
Mon Mar 31 01:11:23 EST 2008
$ which date
/usr/bin/date
Regular Advisor
AL_3001
Posts: 179
Registered: ‎07-05-2007
Message 4 of 22 (273 Views)

Re: Root date not synchronized with user date

Hello,

TZ is time zone variable set on the system. Do echo $TZ as a root user and a normal user or see the profile file of root and normal user. Hope this helps.

ie. of TZ
===================
> echo $TZ
GMT0BST
>
===================

Cheers,
Ashish
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 5 of 22 (273 Views)

Re: Root date not synchronized with user date

Thanks!

but, how to set the TZ for the user's?
i found taht root's TZ is different with user's TZ.

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

N4000_1] / > echo $TZ
mal-8
N4000_1] / >
logout root
$ echo $TZ
sh: TZ: Parameter not set.
Regular Advisor
AL_3001
Posts: 179
Registered: ‎07-05-2007
Message 6 of 22 (273 Views)

Re: Root date not synchronized with user date

Naquid,

DO let us know the o/p of TZ variable. If you have come to a conclusion, still let us know.

All the Best.

Cheers,
Ashish
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 7 of 22 (273 Views)

Re: Root date not synchronized with user date

Hi Ashish,

i didn't get you.. what does it mean? i just set the date, but i wondering why the system is not update the user's time and date.

thanks a lot.
Regular Advisor
AL_3001
Posts: 179
Registered: ‎07-05-2007
Message 8 of 22 (273 Views)

Re: Root date not synchronized with user date

No probs.... Try this

As a normal user, do the following:

1. $TZ=mal-8 (to set the value of TZ variable)

2. $echos $TZ (to check the value set for normal user).


Cheers,
Ashish
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 9 of 22 (273 Views)

Re: Root date not synchronized with user date

Hi Ashish,

this error appeared.

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

$ $TZ=mal-8
sh: TZ: Parameter not set.
$ id
uid=116(faiznaq) gid=20(users)

thanks.
Regular Advisor
AL_3001
Posts: 179
Registered: ‎07-05-2007
Message 10 of 22 (273 Views)

Re: Root date not synchronized with user date

Try to add entry of TZ variable in /etc/profile file.
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 11 of 22 (273 Views)

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..

Regular Advisor
AL_3001
Posts: 179
Registered: ‎07-05-2007
Message 12 of 22 (273 Views)

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.
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 13 of 22 (273 Views)

Re: Root date not synchronized with user date

Hi Ashish,

still not working. i've added in .profile at root. still the same.
Honored Contributor
Yogeeraj_1
Posts: 4,613
Registered: ‎11-25-2001
Message 14 of 22 (273 Views)

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)
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 15 of 22 (273 Views)

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?
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 16 of 22 (273 Views)

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
Honored Contributor
Yogeeraj_1
Posts: 4,613
Registered: ‎11-25-2001
Message 17 of 22 (273 Views)

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)
Advisor
Naqiud
Posts: 33
Registered: ‎01-13-2008
Message 18 of 22 (273 Views)

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..




Acclaimed Contributor
Dennis Handly
Posts: 25,181
Registered: ‎03-06-2006
Message 19 of 22 (273 Views)

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
Acclaimed Contributor
Dennis Handly
Posts: 25,181
Registered: ‎03-06-2006
Message 20 of 22 (273 Views)

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.)
Honored Contributor
Aashique
Posts: 542
Registered: ‎07-21-2007
Message 21 of 22 (273 Views)

Re: Root date not synchronized with user date

Hi Naqiud,
It seems that your user not getting the TimeZone variable.

#more /etc/TIMEZONE

TZ=GMT-6
export TZ

Make correct the GMT value here and then add this timezone to your user .profile.

Thanks & Regards

Aashique
Acclaimed Contributor
Dennis Handly
Posts: 25,181
Registered: ‎03-06-2006
Message 22 of 22 (273 Views)

Re: Root date not synchronized with user date

>Aashique: TZ=GMT-6

Note it is never a good idea to set your timezone to GMT with anything other than 0.
Otherwise you will get a -6 offset but all of the timestamps will say GMT and it will be confusing.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.