1833847 Members
2056 Online
110063 Solutions
New Discussion

Re: Change time - URGENT

 
SOLVED
Go to solution
joe_91
Super Advisor

Change time - URGENT

I have to manually change the time on the server (time in EST. now ahead by 24 hours). After that i have to start the xntpd (the time server is in MST)..I am planning to do this. this is a live production server.

1. stop the apps.

2. change the time

date -u (not sure abt this)

then /sbin/init.d/xntpd start

is this correct?

Thanks

Joe
10 REPLIES 10
Steven E. Protter
Exalted Contributor

Re: Change time - URGENT

Shalom,

You have a problem.

Many applications like Oracle will have problems with their internal time databases if you roll the time back at all.

If you don't have a troublesome application then your plan should work.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: Change time - URGENT

Shalom,

You have a problem.

Many applications like Oracle will have problems with their internal time databases if you roll the time back at all.

If you don't have a troublesome application then your plan should work.

Also understand that time zone is merely a display of time. Time in Unix is measured by the number of secconds since January 1, 1970 when Unix was supposedly born(hatched).

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Peter Godron
Honored Contributor

Re: Change time - URGENT

Joe,
the format for changing the date would be something like:
date 100800452006 for 8 Oct 2006 00:45

(See "man date")

Have you set up yor NTP connection etc.
James R. Ferguson
Acclaimed Contributor

Re: Change time - URGENT

Hi Joe:

Yes. You can use 'date -u' but be sure that the time you specify is UTC (GMT).

Remember, 'xntpd' (NTP) works in UTC. It doesn't matter where its time sources reside. You should use three from the "pool" (for example):

server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Change time - URGENT

Your plan is rather fraught with peril if the time is now 24 hours ahead and you wish to set it backwards. You really need to understand the consequences of this change. For example, you are going to have "old" files that are newer than files that you just changed. Database timestamps are going to be haywire and you have the very real possability of transaction 2000 occurring before transaction 1000 --- which is rather difficult to explain to a customer. Not to mention, reports may not produce bizarre (if not wrong) output. Makefiles are going to be confused.

Now, reading your question another way, you may be trying to set the time ahead 24 hours. That is much safer --- as long as the change is permanent. In that case, your plan is sound.

Whether or not to use date -u mmddhhmmccyy or simply date mmddhhmmccyy depends entirely upon whether you wish to use your local TZ value to set the time or UTC. In any event, if done correctly, the internal time will be set to the same value.

Note: "The statement the time server is in MST. is a meaningless statement. You should understand that a singlre UNIX box can have multiple TZ's -- all of which are correct for users connected from all over the planet. The system simply counts seconds since 1-Jan-1970; TZ controls how those seconds are displayed. An NTP server has no notion of a timezone. Second mistake: Time Server - singular; you want multiple time servers -- at least 3. That way, your clients can make intelligent, statistical decisions about which time servers are good.

Finanly, don't overlook that stepping the time ahead can also cause critical cron tasks to be missed or executed inappropriately.

If it ain't broke, I can fix that.
joe_91
Super Advisor

Re: Change time - URGENT

the time is ahead by 24 hours. when i try to set using date -u mmddhhyyccyy to GMT time. today i had a different time (ahead by 24 hours). so to correct the time, i should set the time back by 24 hours..what would be the correct way to do this?

date -u (using the gmt time)

or just date (using the local time)?

after setting the time. i am going to start the apps/cron jobs and /sbin/init.d/xntpd start.

Pleaze advise

Thanks

Joe
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Change time - URGENT

Again, it doesn't matter if you use date -u or date (which will use the value of TZ in your enviroment -- or more specifically - the TZ value in the date command's environment). If you choose to use date -u then be sure to specify the correct UTC time that you intend; it's probably easier to simply set the time using the local TZ. Either approach (if done correctly) will set the internal time to exactly the same value.

Now that it is clear that you are going to change the time backwards, unless you fully understand the consequences of this action, you might be better advised to wait until this weekend and then shutdown for a day and restart. This will keep all of your timestamps consistant (if wrong) within the week and subsequent tranactions will retain chronological order.
If it ain't broke, I can fix that.
Victor BERRIDGE
Honored Contributor

Re: Change time - URGENT

Hi Joe,

Dont know how bad you are...
Let figure out:
ant:/sm/export/aix/psyche/patches $ date
Mon Feb 19 17:40:45 MET 2007
ant:/sm/export/aix/psyche/patches $ date -u
Mon Feb 19 16:40:48 UTC 2007
ant:/sm/export/aix/psyche/patches $

Try that and see what time/date your box give us.

All the best
Victor (doing some old aix at the moment...)
Bill Hassell
Honored Contributor

Re: Change time - URGENT

You mentioned xntpd...if the GMT time (from dtae -u) is not within 10 minutes of the correct time (and date) then xntpd will give up and not try to sync anything. There is only ONE time on HP-UX and that is GMT (or UTC or Zulu). Everything else is translated by the TZ variable.

Now if you setup NTP correctly, the file /etc/rc.config.d/netdaemons has specified a working NTP server which will 'jump' the time to the correct value when you reboot. Then xntpd will be started and will keep your server in sync. The value of $TZ defines the timezone translation. If it is wrong, DO NOT change the time. Check that date -u is correct. If it is, then select the correct value for TZ. TZ is defaulted in the file /etc/TIMEZONE. Multiple users in different timezones can override this default value to match their local time.


Bill Hassell, sysadmin
joe_91
Super Advisor

Re: Change time - URGENT

Thanks all. it worked OK.

Thanks

Joe