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

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

depend() {
	need net
}

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 $?
}