- aptitude install ntpdate
- ntpdate 0.ca.pool.ntp.org
- emacs /etc/ntpdate.conf:
server time.chu.nrc.ca
server time.nrc.ca
server tick.utoronto.ca
server tock.utoronto.ca
server 0.ca.pool.ntp.org
server 1.ca.pool.ntp.org
server 2.ca.pool.ntp.org
server 3.ca.pool.ntp.org - emacs /etc/cron.daily/ntpdate
- chmod a+x ntpdate
#!/bin/bash
# ntpdate cron nightly
NTPDATE=/usr/sbin/ntpdate
LOGFILE=/var/log/ntpdate.log
NTPCONFFILE=/etc/ntpdate.conf
NTPSERVERS=
GREP=/usr/bin/grep
CUT=/usr/bin/cut
if [ -f $NTPCONFFILE ] ; then
echo "===ntpdatentpdatentpdatentpdatentpdate===" >> $LOGFILE
echo "<<< `date` " >> $LOGFILE
for i in `grep ^server $NTPCONFFILE | $CUT -f 2 -d \ `
do
NTPSERVERS="$NTPSERVERS $i"
done
$NTPDATE $NTPSERVERS >> $LOGFILE
###echo $NTPDATE $NTPSERVERS $LOGFILE
echo ">>> `date` " >> $LOGFILE
fi
exit 0
NTP Time Service List
Sometimes, one needs to adjust the time zone:
$ tzselet
没有评论:
发表评论