Hochschule Augsburg
NTP Service - Usage
Client Start/Stop Script
#!/bin/sh
#
# /sbin/xntp
#
killproc() { # kill named processes
pid=`/usr/bin/ps -e |
/usr/bin/grep $1 |
/usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
[ "$pid" != "" ] && kill $pid
}
startntp() { # start xntpd daemon
if [ -f /etc/ntp.conf -a -x /usr/local/bin/xntpd ]
then
# /usr/local/bin/tickadj -A
/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
ulimit -s 128
/usr/local/bin/xntpd -c /etc/ntp.conf
fi
}
case "$1" in
'start')
ps -e | grep xntpd > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "ntp daemon already running. ntp start aborted"
exit 0
fi
startntp
;;
'stop')
killproc xntpd
;;
'restart')
ps -e | grep xntpd > /dev/null 2>&1
if [ $? -eq 0 ]
then
killproc xntpd
fi
startntp
;;
*)
echo "Usage: /sbin/xntp { start | stop | restart }"
;;
esac
This is a template start/stop script especially suitable for
AIX. You may have to adapt it to your environment. Check
the path to the shell, to the xntp binaries, and to the
script itself.
The call to
tickadj -A resets the tickadj kernel
variable to its default. This or another value
(e.g.
tickadj -a 120) may be required if the system clock
is peered in the configuration. If the daemon doesn't stabilize,
you should read the topic 'Dealing with Frequency Tolerance Violations
(tickadj and Friends)' in
Notes on Configuring NTP and Setting up a NTP Subnet
in the documentation. You will also need the
tickadj manpage. Especially for AIX machines the
NTP FAQ should be scanned for special information. Good luck!
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.
The line ulimit -s 128 is strongly recommended
for AIX, though not for other Unix variants. The daemon will
fill up much of the system memory if this command is missing.
Restarting would be needed to force a configuration
file reread or to trim a log file. Both are not needed in
this client configuration.
1999-07-15