2008-02-02 02:14:00 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2008 OpenWrt.org
|
|
|
|
|
|
|
|
START=80
|
|
|
|
|
|
|
|
config_cb() {
|
|
|
|
local cfg="$CONFIG_SECTION"
|
|
|
|
local cfgtype
|
|
|
|
config_get cfgtype "$cfg" TYPE
|
|
|
|
|
2008-04-22 23:52:07 +00:00
|
|
|
if [ "$cfgtype" = ntpclient ]
|
|
|
|
then
|
|
|
|
config_get hostname $cfg hostname
|
|
|
|
config_get port $cfg port
|
|
|
|
config_get count $cfg count
|
2008-02-02 02:14:00 +00:00
|
|
|
|
2008-04-22 23:52:07 +00:00
|
|
|
ps | grep -q 'bin/[n]tpclient' || \
|
|
|
|
/usr/sbin/ntpclient -s -c ${count:-1} -l -h $hostname -p ${port:-123} 2>&- >&- &
|
|
|
|
fi
|
2008-02-02 02:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
config_load ntpclient&
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
killall ntpclient 2>&- >&-
|
|
|
|
}
|