base-files: convert sysntpd init script to procd

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 37244
This commit is contained in:
John Crispin 2013-07-11 17:00:35 +00:00
parent 928b503435
commit 8069d87d3c

View file

@ -3,11 +3,11 @@
START=98 START=98
SERVICE_DAEMONIZE=1 USE_PROCD=1
SERVICE_WRITE_PID=1 PROG=/usr/sbin/ntpd
SERVICE_PID_FILE=/var/run/sysntpd.pid SERVICE_PID_FILE=/var/run/sysntpd.pid
start() { start_service() {
local peers local peers
local args="-n" local args="-n"
local enable_server local enable_server
@ -16,22 +16,16 @@ start() {
config_get peers ntp server config_get peers ntp server
config_get_bool enable_server ntp enable_server 0 config_get_bool enable_server ntp enable_server 0
if [ $enable_server -ne 0 ]; then [ $enable_server -eq 0 -a -z "$peers" ] && return
append args "-l"
fi
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 local peer
for peer in $peers; do for peer in $peers; do
append args "-p $peer" procd_append_param command -p $peer
done done
fi
if [ "$args" != "-n" ]; then
service_start /usr/sbin/ntpd $args
fi
} }
procd_close_instance
stop() {
service_stop /usr/sbin/ntpd
} }