1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!/bin/sh
#
# A minimal init script for htpdate
### BEGIN INIT INFO
# Provides: htpdate
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start htpdate daemon
### END INIT INFO
test -x /usr/bin/htpdate || exit 0
PIDFILE="/var/run/htpdate.pid"
SERVERS="www.linux.org www.freebsd.org"
# See how we were called.
case "$1" in
start)
echo "Starting HTTP Time Protocol daemon: htpdate"
# Set the time first before daemonizing, because the time offset
# might be too big for smooth time adjustment
/usr/bin/htpdate -D -s -i $PIDFILE $SERVERS
;;
stop)
echo "Stopping HTTP Time Protocol daemon: htpdate"
if [ -f $PIDFILE ]
then
kill `cat $PIDFILE`
else
echo "$PIDFILE not found"
fi
rm -f $PIDFILE
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
# vi:set ts=4:
|