2011-10-27 03:21:53 +03:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2011 OpenWrt.org
|
|
|
|
|
|
|
|
START=98
|
|
|
|
|
2011-11-08 00:58:34 +02:00
|
|
|
SERVICE_DAEMONIZE=1
|
|
|
|
SERVICE_WRITE_PID=1
|
|
|
|
SERVICE_PID_FILE=/var/run/sysntpd.pid
|
2011-10-27 03:21:53 +03:00
|
|
|
|
|
|
|
start() {
|
2011-11-08 00:58:34 +02:00
|
|
|
[ -x $PROG ] || return 1
|
2011-10-27 03:21:53 +03:00
|
|
|
|
|
|
|
local peers
|
|
|
|
|
|
|
|
getpeers() {
|
|
|
|
config_get peers "$1" server
|
|
|
|
}
|
|
|
|
|
|
|
|
config_load system
|
|
|
|
config_foreach getpeers timeserver
|
|
|
|
|
|
|
|
if [ -n "$peers" ]; then
|
|
|
|
local peer
|
|
|
|
local args="-n"
|
|
|
|
for peer in $peers; do
|
|
|
|
append args "-p $peer"
|
|
|
|
done
|
|
|
|
|
2011-11-08 00:58:34 +02:00
|
|
|
service_start /usr/sbin/ntpd $args
|
2011-10-27 03:21:53 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2011-11-08 00:58:34 +02:00
|
|
|
service_stop /usr/sbin/ntpd
|
2011-10-27 03:21:53 +03:00
|
|
|
}
|