blob: a3ce567015087406a6e1437633713f2dc866b034 (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/ntpd: start/stop ntp daemon
4 #
5
6 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
7
8 USER="root"
9 RUNDIR="/var/run/openntpd"
10 PIDFILE="$RUNDIR/openntpd.pid"
11 PROG="/usr/sbin/ntpd"
12 ARGS="-s -p $PIDFILE"
13
14 case $1 in
15 start)
16 install -d -m 755 -o $USER $RUNDIR || exit 1
17 start-stop-daemon --start --pidfile $PIDFILE --exec $PROG -- $ARGS
18 ;;
19 stop)
20 start-stop-daemon --stop --retry 60 --pidfile $PIDFILE
21 ;;
22 restart)
23 $0 stop
24 $0 start
25 ;;
26 status)
27 start-stop-daemon --status --pidfile $PIDFILE
28 case $? in
29 0) echo "$PROG running with pid: $(cat $PIDFILE)" ;;
30 1) echo "$PROG not running, stale pidfile: $PIDFILE" ;;
31 3) echo "$PROG not running" ;;
32 4) echo "Unable to determine program status" ;;
33 esac
34 ;;
35 *)
36 echo "usage: $0 [start|stop|restart|status]"
37 ;;
38 esac
|