package/base-files: move service* functions from /etc/rc.common to /lib/functions.sh
[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 SERVICE_DAEMONIZE=1
7 SERVICE_WRITE_PID=1
8 SERVICE_PID_FILE=/var/run/sysntpd.pid
9
10 start() {
11 [ -x $PROG ] || return 1
12
13 local peers
14
15 getpeers() {
16 config_get peers "$1" server
17 }
18
19 config_load system
20 config_foreach getpeers timeserver
21
22 if [ -n "$peers" ]; then
23 local peer
24 local args="-n"
25 for peer in $peers; do
26 append args "-p $peer"
27 done
28
29 service_start /usr/sbin/ntpd $args
30 fi
31 }
32
33 stop() {
34 service_stop /usr/sbin/ntpd
35 }
This page took 0.043106 seconds and 5 git commands to generate.