move qc-usb from trunk to packages as well (see [12260])
[openwrt/svn-archive/archive.git] / net / ntpclient / files / ntpclient.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 OpenWrt.org
3
4 START=80
5
6 config_cb() {
7 local cfg="$CONFIG_SECTION"
8 local cfgtype
9 config_get cfgtype "$cfg" TYPE
10
11 if [ "$cfgtype" = ntpclient ]
12 then
13 config_get hostname $cfg hostname
14 config_get port $cfg port
15 config_get count $cfg count
16
17 ps | grep -q 'bin/[n]tpclient' || \
18 /usr/sbin/ntpclient -s -c ${count:-1} -l -h $hostname -p ${port:-123} 2>&- >&- &
19 fi
20 }
21
22 start() {
23 config_load ntpclient&
24 }
25
26 stop() {
27 killall ntpclient 2>&- >&-
28 }