Hochschule Augsburg
NTP Service - Usage
Client Start/Stop Script
#!/bin/sh
#
# /sbin/init.d/xntp
#

case "$1" in
  start)
    if test -x /usr/local/bin/xntpd ; then
      echo "Starting NTP service xntpd."
      /usr/local/bin/ntpdate kipling.rz.fh-augsburg.de
      /usr/local/bin/ntpdate compact.rz.fh-augsburg.de
      /usr/local/bin/ntpdate kim.rz.fh-augsburg.de
      /usr/local/bin/xntpd -p /var/run/xntpd.pid 
    fi
    ;;
  stop)
    if [ -f  /var/run/xntpd.pid ] ; then
      echo "Shutting down NTP service."
      kill `cat /var/run/xntpd.pid`
      rm -f /var/run/xntpd.pid
    else 
      echo "xntpd not runnig?"
    fi
    ;;
  restart)
    if [ -f  /var/run/xntpd.pid ] ; then
      echo "Restarting NTP service xntpd."
      kill -1 `cat /var/run/xntpd.pid`
    else
      echo "xntpd not runnig?"
    fi
    if test -x /usr/local/bin/xntpd ; then
      /usr/local/bin/xntpd -p /var/run/xntpd.pid 
    fi
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit 0
 
This is a template start/stop script suitable for S.u.S.E. Linux. You may have to adapt it to your environment. Check the path to the shell, to the xntp binaries, and to the script itself.
Let the daemon process id be stored in a file or use the script 'scripts/xntp' in the distribution for stop and restart. Restarting would be needed to force a configuration file reread or to trim a log file. Both are not needed in this client configuration.
The threefold call of ntpdate will correct your system clock to a very good value before starting the daemon. The offset to UTC will be about +/- 10 ms without much delay. If one of the servers is down there are still two. The here mentioned servers are in our department network. They are reachable in our campus network only, so you have to poll different ones if you are not in here.
1999-07-15
© B. Erdlenbruch
Legal Information