Operating System - HP-UX
1834804 Members
2951 Online
110070 Solutions
New Discussion

system time is all the sudden changed?

 
SOLVED
Go to solution
Hanry Zhou
Super Advisor

system time is all the sudden changed?

Don't know what caused it, but the date is 15 days off the right date.

I used date -u to change the time back. Is that right way to correct it?

Thanks,
none
12 REPLIES 12
Pete Randall
Outstanding Contributor

Re: system time is all the sudden changed?

Changing the date/time backwards can cause problems with the timestamps in DB applications. In that case, it is better to change gradually. If you have no DB apps, or you are changing the time forward, then there is no problem.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: system time is all the sudden changed?

The date command is the correct approach with or with -u which simply means that you are specifying the time as UTC rather than your current TZ value. However, you may have very serious problems especially with databases because now you may have transactions which appear to be completely out of order so that for example transaction 100 now occurs before transaction 99 --- something that is a little difficult to explain to a customer. If this box is used for development, utilities like make will also be confused because the file timestamps are used to discern what source files need to be recompiled to produce objects.

You really need to find out how the system date got changed but because only a superuser is allowed to change the system date, the list of likely suspects should be a short one. Of course, a setuid executable owned by root would also do the trick as would sudo.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: system time is all the sudden changed?

Hi Hanry:

You can use 'date' with or without '-u' to change the date as noted in the manpages.

*However*, any time you change a date backwards, you should stop all databases; change the date; and then stop and (re)start the 'cron' daemon: '/sbin/init.d/cron'.

Only the 'root' can change the time. Someone has probably attempted to reset it and mangled his/her entry. This is a serious problem.

You be running 'xntpd' (Network Time Protocol (NTP)) in order to keep your server's time synchronized to a good external source.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: system time is all the sudden changed?

Normal users cannot change the date so you need to talk with *ALL* the users that have the root password. The date command (to set a new date) is very dangerous on a database system. If you can't setup NTP to sync the time, don't change the time backward until all databases are shutdown.


Bill Hassell, sysadmin
Hanry Zhou
Super Advisor

Re: system time is all the sudden changed?

It happend again after I corrected the time, the time on the system seems to be stopped again. This is 3rd time in the row.

I have tried everything suggested in the thread. any idea what is causing the problem?

thanks,
none
DCE
Honored Contributor

Re: system time is all the sudden changed?



Hanry,

1. set time to correct time/date
2. set up ntp to another server to keep time in sync (use SAM if not familar with not setup)
3. if the system time changes again
a. check the logs to see if you discover if anyone changed the time
syslog
each users .sh_history file
b. if the time stops, i.e does not change at all after you alter it - call HP for service.
A. Clay Stephenson
Acclaimed Contributor

Re: system time is all the sudden changed?

What command EXACTLY are you using to display the system date? It should not be possible to stop the date on a UNIX box (unless the time were continuously being reset).
If it ain't broke, I can fix that.
Hanry Zhou
Super Advisor

Re: system time is all the sudden changed?

Let me rephrase my word. It is actually not stopped, but the time seems running very very slow. I corrected the time last Friday, and today when I run "date" command, it still shows me that Friday.

none
Hanry Zhou
Super Advisor

Re: system time is all the sudden changed?

Let me rephrase my word. It is actually not stopped, but the time seems running very very slow. I corrected the time last Friday, and today when I run "date" command, it still shows me that Friday.

DEC,

I have already tried all steps you suggeste.
none
Patrick Wallek
Honored Contributor

Re: system time is all the sudden changed?

Did you do a 'date -a' to slowly change the time? If so, it will take a long time to change the time by 15 days.
A. Clay Stephenson
Acclaimed Contributor

Re: system time is all the sudden changed?

It is now time for more precise language.

You said "seems running very very slow". What does that mean? I suggest that you examinie the system date and again what command are you using to display the date? and then wait 1 hour (as measured by your watch or a (non-computer) clock and then examine the date again to see if your system thinks that 1 hour has transpassed.


On some boxes there was a firmware patch to correct erratic/drifting hardware clocks but in any event, once you get the system date within a few tens of seconds of "correct time", NTP should then be able to maintain time accurate to with a few tens of milliseconds.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: system time is all the sudden changed?

Hi (again) Hanry:

Yes, you need to setup 'xntpd' (NTP), *but* having done that you will need to set your server's time to a very near correct value to allow 'xntpd' to correct your server's time. NTP will abandon all attempts at time synchronization if its time source and its server differ by more than about 1000 seconds.

I would suggest that you configure NTP to set its clock to its time source(s) during bootup (by configuring the NTPDATE_SERVER variable in '/etc/rc.config.d/netdaemons') and thereafter run continuously. You need to correct your server's time but you need to incur the cost of a reboot to do so.

Regards!

...JRF...