| Author |
Message |
|
|
Post subject: Sync system's time
Posted: May 17, 2008 - 01:41 PM
|
|

Joined: Dec 02, 2006
Posts: 1045
Location: East Coast
Status: Offline
|
|
I've been using fix-time to sync my computers' time, but I was getting tired of pressing ENTER twice when dpkg-reconfigure tzdata asks me what time zone I wanted. I've cut some stuff from sidux's fix-time script
Code:
#!/bin/bash
# Updates the system's clock once the time zone has been set previously
# Servers can be found at:
# http://www.pool.ntp.org/zone/@
NTPSERVER="0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org 3.us.pool.ntp.org"
# sync with time servers
for i in $NTPSERVER; do
if ntpdate -u -b "$i"; then
hwclock --systohc
break
fi
done
|
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Sync system
Posted: May 17, 2008 - 01:47 PM
|
|
Joined: Nov 25, 2006
Posts: 2570
Status: Offline
|
|
Why?
ntpdate is called by ifup.d --> for those who shut down their systems at night once a day (at each reboot, when the network interface goes up).
Only servers (:= as system running around the clock with months of uptime) would need regular ntp syncs, what about adding a call to /usr/sbin/ntpdate-debian to cron.daily? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Sync system
Posted: May 17, 2008 - 01:57 PM
|
|

Joined: Dec 02, 2006
Posts: 1045
Location: East Coast
Status: Offline
|
|
You've nailed one more time. Yes, the script is needed for a server. I'll add ntpdate-debian to cron.daily
Thank you |
|
|
| |
|
|
|
 |
|
|
|
|