summaryrefslogtreecommitdiffstats
path: root/main/sntpc/sntpc.initd
blob: a62c6d3527aa4193dc8890af480286cd88183bb0 (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
#!/sbin/runscript

NAME=sntpc
DAEMON=/usr/sbin/$NAME

depend() {
	need net
	after firewall
}

start() {
	local msg opts
	if [ "$SNTPC_INTERVAL" = "0" ]; then
		msg="Setting time from NTP source"
	else
		msg="Starting ${NAME}"
		opts="-d"
	fi
	ebegin "$msg"
		start-stop-daemon --start --quiet --name sntpc \
			--exec ${DAEMON} -- \
			-i ${SNTPC_INTERVAL} $opts ${SNTPC_HOST}
	eend $?
}

stop() {
	ebegin "Stopping ${NAME}"
		start-stop-daemon --stop --quiet \
			--exec ${DAEMON} 
	eend $?
}