opt/openntpd/ntpd

40 lines
770 B
Plaintext
Raw Normal View History

2016-08-15 09:14:46 +02:00
#!/bin/sh
#
# /etc/rc.d/ntpd: start/stop ntp daemon
#
2014-11-19 03:14:36 +01:00
2016-08-15 09:14:46 +02:00
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
USER="root"
2016-01-02 11:40:44 +01:00
RUNDIR="/var/run/openntpd"
PIDFILE="$RUNDIR/openntpd.pid"
2016-08-15 09:14:46 +02:00
PROG="/usr/sbin/ntpd"
ARGS="-s -p $PIDFILE"
2006-02-23 16:26:10 +01:00
case $1 in
2014-11-19 03:14:36 +01:00
start)
install -d -m 755 -o $USER $RUNDIR || exit 1
2016-08-15 09:14:46 +02:00
start-stop-daemon --start --pidfile $PIDFILE --exec $PROG -- $ARGS
2006-02-23 16:26:10 +01:00
;;
2014-11-19 03:14:36 +01:00
stop)
2016-08-15 09:14:46 +02:00
start-stop-daemon --stop --retry 60 --pidfile $PIDFILE
2006-02-23 16:26:10 +01:00
;;
2014-11-19 03:14:36 +01:00
restart)
2006-02-23 16:26:10 +01:00
$0 stop
$0 start
;;
2014-11-19 03:14:36 +01:00
status)
2016-08-15 09:14:46 +02:00
start-stop-daemon --status --pidfile $PIDFILE
case $? in
0) echo "$PROG running with pid: $(cat $PIDFILE)" ;;
1) echo "$PROG not running, stale pidfile: $PIDFILE" ;;
3) echo "$PROG not running" ;;
4) echo "Unable to determine program status" ;;
esac
2014-11-19 03:14:36 +01:00
;;
*)
echo "usage: $0 [start|stop|restart|status]"
2006-02-23 16:26:10 +01:00
;;
esac