Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

ntpdate -B to adjust clock with NTP server

SOLVED
Go to solution
chindi
Respected Contributor

ntpdate -B to adjust clock with NTP server

Hi ,

 

Can i safely adjust my current server timings i.e hpux 11i v2  with Linux NTP server using ntpdate -B option .

Since this option slowly adjusts itself , can i do it in my production setup ?

 

 

P.S. This thread has been moved from HP-UX > System Administration to HP-UX > networking.
-HP Forum Moderator

6 REPLIES
Bill Hassell
Honored Contributor
Solution

Re: ntpdate -B to adjust clock with NTP server

Yes, using -B is the best way to adjust the clock. The -B option guarentees that there will be exactly 86,400 seconds per day. The OS clock will have each second trimmed or elongated a small fraction until the clock is in sync. But there are not enough seconds to adjust a difference of more than about 10 minutes. If you run ntpdate -B with a 20 minute or larger gap, the program will not run.

 

So before you change the time on a system running a typical commercial database, shut it down! Changing the date while databases are active can lead to sync issues between files and eventually a database recovery. While you could change the date manually, if you have *working* NTP servers, make sure the server listed in /etc/rc.config.d/netdaemons is working (hint: ntpdate -p <server_name>). Then shutdown and let the server reboot. By shutting down all the applications and databases, the system will be ready for a correct date/time on reboot.

 

Also be very careful about 1 hour time errors. You may have the timezone misconfigured. The OS is always set to UTC time, also known as Zulu or the obsolete Greenwich Mean Time (GMT) value. Then the OS libraries will translate this universal time into local time using the current value of the variable $TZ. This value is set when logging using the directive in /etc/TIMEZONE. If this is incorrect, do not set the time to compensate. Change the value in /etc/TIMEZONE, then login again and check the time.

 

The exact time is critical among clusters and networked databases (most are network-based). NTP will ensure exact sync (accurate to within 10ms). Every system should be running NTP service.



Bill Hassell, sysadmin
chindi
Respected Contributor

Re: ntpdate -B to adjust clock with NTP server

Hi Bill ,

 

thanks for that explaination.

We have a linux ntp server , when ntpq -pn gives 

 

[root@centsvr ~]# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
-27.114.150.13 131.188.3.223 2 u 75 1024 377 72.199 18.831 20.477
+119.81.14.18 47.187.174.51 2 u 675 1024 377 75.027 -0.348 32.927
+59.106.180.168 131.112.181.48 2 u 642 1024 377 170.104 -9.848 16.875
*106.187.94.109 10.84.87.146 2 u 609 1024 377 147.155 1.175 0.514
127.127.1.0 .LOCL. 10 l 23 64 377 0.000 0.000 0.002

 

And timezone is on NTP server

[root@centsvr ~]# date +%Z
IST
[root@centsvr ~]# uname -a
Linux centsvr 2.6.18-194.el5xen #1 SMP Fri Apr 2 15:34:40 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

 

And on clients its hpux ;

root #/ >ntpq -np
remote refid st t when poll reach delay offset disp
==============================================================================
*10.1.5.xx 106.187.94.109 3 u 477 512 377 27.82 -0.366 0.66
127.127.1.1 127.127.1.1 3 l 33 64 377 0.00 0.000 10.01

 

root #/ >env|grep -i tz
TZ=IST-5:30

 

I hope there will be no Timezone issues here , right ?

 

 

Dennis Handly
Acclaimed Contributor

Re: ntpdate -B to adjust clock with NTP server

>This value is set when logging in using the directive in /etc/PATH. ... Change the value in /etc/PATH

 

I think you meant /etc/TIMEZONE instead.  You can edit your post with Post Options > Edit Reply.

 

>I hope there will be no Timezone issues here, right?

 

Right.  Linux and HP-UX use UTC for NTP and won't have a problem.

Bill Hassell
Honored Contributor

Re: ntpdate -B to adjust clock with NTP server

>> /etc/PATH should be /etc/TIMEZONE

 

(fixed)

 

>> ...no Timezone issues...

 

As long as this $TZ value matches your location. HP-UX can provide an exact match to any user logging into the system by setting the TZ value to match the local timezone. This means that all time/date values will be in local time for every user.



Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: ntpdate -B to adjust clock with NTP server

>This means that all time/date values will be in local time for every user.

 

Unless they like UTC or another timezone that they may be supporting.

 

Note: Some logfiles like syslog.log show the system's local time and not the user's.

chindi
Respected Contributor

Re: ntpdate -B to adjust clock with NTP server

Thanks Bill , Dennis .