页面

2008-05-11

Debian etch Web Time Service Configuration

  1. aptitude install ntpdate
  2. ntpdate 0.ca.pool.ntp.org
  3. 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
  4. emacs /etc/cron.daily/ntpdate
  5. #!/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
  6. chmod a+x ntpdate
One may find ntp service list here:
NTP Time Service List

Sometimes, one needs to adjust the time zone:
$ tzselet

没有评论: