fefb48fb19ee510850e8c912f89249867eb8e0a7
[openwrt.git] / package / base-files / files / etc / init.d / sysntpd
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2011 OpenWrt.org
3
4 START=98
5
6 BIN=/usr/sbin/ntpd
7 PID=/var/run/sysntpd.pid
8
9 start() {
10 [ -x $BIN ] || exit 0
11
12 local peers
13
14 getpeers() {
15 config_get peers "$1" server
16 }
17
18 config_load system
19 config_foreach getpeers timeserver
20
21 if [ -n "$peers" ]; then
22 local peer
23 local args="-n"
24 for peer in $peers; do
25 append args "-p $peer"
26 done
27
28 start-stop-daemon -x $BIN -m -p $PID -b -S -- $args
29 fi
30 }
31
32 stop() {
33 service_kill ${BIN##*/} $PID
34 rm -f $PID
35 }
This page took 0.045821 seconds and 3 git commands to generate.