aboutsummaryrefslogtreecommitdiff
path: root/network/openntpd/rc.openntpd
blob: 55d082b0fb14c220de9832167137cd700471208e (plain)
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
#!/bin/sh

# Start/stop/restart the network time protocol daemon 

# Written for Slackware Linux by Robby Workman <http://rlworkman.net> 
# (by modifying one of Pat's scripts)

# Add -s to the command to set the time at startup

openntpd_start() {
  if [ -x ${BIN} ]; then
    echo "Starting openntpd daemon:  ${BIN}"
    ${BIN} -p /var/run/openntpd.pid &
  fi
}

openntpd_stop() {
  echo "Stopping openntpd daemon..."
  pkill -x $(basename ${BIN})
}

openntpd_restart() {
  openntpd_stop
  sleep 1
  openntpd_start
}

BIN=/usr/sbin/openntpd

case "$1" in
	'start')
		openntpd_start
	;;
	'stop')
		openntpd_stop
	;;
	'restart')
		openntpd_restart
	;;
	*)
		echo "usage $0 start|stop|restart"
	;;
esac