forked from hashbang/shell-etc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenntpd
executable file
·80 lines (64 loc) · 1.81 KB
/
openntpd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
### BEGIN INIT INFO
# Provides: openntpd
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start openntpd at boot time
# Description: NTP, the Network Time Protocol, is used to keep the
# computer clocks synchronized.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ntpd
NAME=ntpd
USER=ntpd
DESC=openntpd
test -e /usr/sbin/openntpd || exit 0
test -f /lib/lsb/init-functions || exit 1
. /lib/lsb/init-functions
# Include openntpd defaults if available
if [ -f /etc/default/openntpd ]; then
. /etc/default/openntpd
fi
DAEMON_OPTS="${DAEMON_OPTS:-} -p /var/run/openntpd.pid"
set -e
case "$1" in
start)
if [ ! -d "/var/run/openntpd" ]; then
mkdir -p /var/run/openntpd
fi
echo -n "Starting $DESC: "
if status_of_proc "$DAEMON" $DESC > /dev/null; then
log_begin_msg "Already running."
else
start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
fi
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --oknodo --quiet --retry=TERM/30/KILL/5 --user root --exec $DAEMON
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --oknodo --quiet --retry=TERM/30/KILL/5 --user root --exec $DAEMON
start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
status)
start-stop-daemon --test --stop --quiet --user root --exec $DAEMON && \
log_success_msg "OpenNTPd daemon is running." || \
( log_failure_msg "OpenNTPd daemon is NOT running" && exit 1 )
;;
check)
$DAEMON $DAEMON_OPTS "-n"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status|check}" >&2
exit 1
;;
esac
exit 0