aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2013-07-11 17:00:35 +0000
committerJohn Crispin <blogic@openwrt.org>2013-07-11 17:00:35 +0000
commitebc1e022302d2556203bf14b59b43604a8cd0a8e (patch)
tree36d78d0ddba9738e4c953b8cde02c6594ceba297
parent55bf8ea96ab2a8b96313e7a9b43b6e730dfba73a (diff)
downloadupstream-ebc1e022302d2556203bf14b59b43604a8cd0a8e.tar.gz
upstream-ebc1e022302d2556203bf14b59b43604a8cd0a8e.tar.bz2
upstream-ebc1e022302d2556203bf14b59b43604a8cd0a8e.zip
base-files: convert sysntpd init script to procd
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37244 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/base-files/files/etc/init.d/sysntpd28
1 files changed, 11 insertions, 17 deletions
diff --git a/package/base-files/files/etc/init.d/sysntpd b/package/base-files/files/etc/init.d/sysntpd
index bb42ef7d3a..c40ee76da3 100755
--- a/package/base-files/files/etc/init.d/sysntpd
+++ b/package/base-files/files/etc/init.d/sysntpd
@@ -3,11 +3,11 @@
START=98
-SERVICE_DAEMONIZE=1
-SERVICE_WRITE_PID=1
+USE_PROCD=1
+PROG=/usr/sbin/ntpd
SERVICE_PID_FILE=/var/run/sysntpd.pid
-start() {
+start_service() {
local peers
local args="-n"
local enable_server
@@ -16,22 +16,16 @@ start() {
config_get peers ntp server
config_get_bool enable_server ntp enable_server 0
- if [ $enable_server -ne 0 ]; then
- append args "-l"
- fi
+ [ $enable_server -eq 0 -a -z "$peers" ] && return
- if [ -n "$peers" ]; then
+ procd_open_instance
+ procd_set_param command "$PROG" -n
+ [ $enable_server -ne 0 ] && procd_append_param command -l
+ [ -n "$peers" ] && {
local peer
for peer in $peers; do
- append args "-p $peer"
+ procd_append_param command -p $peer
done
- fi
-
- if [ "$args" != "-n" ]; then
- service_start /usr/sbin/ntpd $args
- fi
-}
-
-stop() {
- service_stop /usr/sbin/ntpd
+ }
+ procd_close_instance
}