aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/init.d/sysntpd
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/etc/init.d/sysntpd')
-rwxr-xr-xpackage/base-files/files/etc/init.d/sysntpd37
1 files changed, 37 insertions, 0 deletions
diff --git a/package/base-files/files/etc/init.d/sysntpd b/package/base-files/files/etc/init.d/sysntpd
new file mode 100755
index 000000000..bb42ef7d3
--- /dev/null
+++ b/package/base-files/files/etc/init.d/sysntpd
@@ -0,0 +1,37 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=98
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+SERVICE_PID_FILE=/var/run/sysntpd.pid
+
+start() {
+ local peers
+ local args="-n"
+ local enable_server
+
+ config_load system
+ config_get peers ntp server
+ config_get_bool enable_server ntp enable_server 0
+
+ if [ $enable_server -ne 0 ]; then
+ append args "-l"
+ fi
+
+ if [ -n "$peers" ]; then
+ local peer
+ for peer in $peers; do
+ append args "-p $peer"
+ done
+ fi
+
+ if [ "$args" != "-n" ]; then
+ service_start /usr/sbin/ntpd $args
+ fi
+}
+
+stop() {
+ service_stop /usr/sbin/ntpd
+}