aboutsummaryrefslogtreecommitdiffstats
path: root/main/sntpc/sntpc.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/sntpc/sntpc.initd')
-rw-r--r--main/sntpc/sntpc.initd30
1 files changed, 30 insertions, 0 deletions
diff --git a/main/sntpc/sntpc.initd b/main/sntpc/sntpc.initd
new file mode 100644
index 0000000000..a97e51bdbd
--- /dev/null
+++ b/main/sntpc/sntpc.initd
@@ -0,0 +1,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 $?
+}