Merge branch 'master' of git://repo.or.cz/buildroot
[buildroot.git] / package / ntp / ntp.sysvinit
blob4e8f1107f0d2ad5c4d7cc37226037dbf6aa79e49
1 #! /bin/sh
3 # System-V init script for the openntp daemon
6 set -e
8 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
9 DESC="network time protocol daemon"
10 NAME=ntpd
11 DAEMON=/usr/sbin/$NAME
13 # Gracefully exit if the package has been removed.
14 test -x $DAEMON || exit 0
16 # Read config file if it is present.
17 if [ -r /etc/default/$NAME ]
18 then
19 . /etc/default/$NAME
22 case "$1" in
23 start) echo -n "Starting $DESC: $NAME"
24 start-stop-daemon -S -q -x $DAEMON
25 echo "."
27 stop) echo -n "Stopping $DESC: $NAME"
28 start-stop-daemon -K -q -n $NAME
29 echo "."
31 reload|force-reload) echo -n "Reloading $DESC configuration..."
32 start-stop-daemon -K -q -n $NAME -s 1
33 echo "done."
35 restart) echo -n "Restarting $DESC: $NAME"
36 start-stop-daemon -K -q -n $NAME
37 sleep 1
38 start-stop-daemon -S -q -x $DAEMON
39 echo "."
41 *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
42 exit 1
44 esac
46 exit 0