2007-06-25 20:27:58 +02:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# System-V init script for the openntp daemon
|
|
|
|
#
|
|
|
|
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
|
DESC="network time protocol daemon"
|
|
|
|
NAME=ntpd
|
|
|
|
DAEMON=/usr/sbin/$NAME
|
2008-11-06 22:11:54 +01:00
|
|
|
NTPDATE_BIN=/usr/bin/ntpdate
|
2007-06-25 20:27:58 +02:00
|
|
|
|
|
|
|
# Gracefully exit if the package has been removed.
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
|
|
|
|
# Read config file if it is present.
|
|
|
|
if [ -r /etc/default/$NAME ]
|
|
|
|
then
|
|
|
|
. /etc/default/$NAME
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$1" in
|
2008-11-06 22:11:54 +01:00
|
|
|
start)
|
2011-02-04 20:00:35 +01:00
|
|
|
if [ -x $NTPDATE_BIN ] ; then
|
2008-11-06 22:11:54 +01:00
|
|
|
echo -n "Getting initial time via ntp"
|
|
|
|
$NTPDATE_BIN $NTPDATE_OPTS $NTPSERVERS > /dev/null 2>&1
|
|
|
|
echo "."
|
|
|
|
fi
|
2011-02-04 20:00:35 +01:00
|
|
|
|
|
|
|
echo -n "Starting $DESC: $NAME"
|
|
|
|
start-stop-daemon -S -q -x $DAEMON
|
|
|
|
echo "."
|
2007-06-25 20:27:58 +02:00
|
|
|
;;
|
|
|
|
stop) echo -n "Stopping $DESC: $NAME"
|
|
|
|
start-stop-daemon -K -q -n $NAME
|
|
|
|
echo "."
|
|
|
|
;;
|
|
|
|
reload|force-reload) echo -n "Reloading $DESC configuration..."
|
|
|
|
start-stop-daemon -K -q -n $NAME -s 1
|
|
|
|
echo "done."
|
|
|
|
;;
|
2008-11-14 23:52:48 +01:00
|
|
|
restart) echo "Restarting $DESC: $NAME"
|
|
|
|
$0 stop
|
2007-06-25 20:27:58 +02:00
|
|
|
sleep 1
|
2008-11-14 23:52:48 +01:00
|
|
|
$0 start
|
2007-06-25 20:27:58 +02:00
|
|
|
;;
|
|
|
|
*) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|