ntpclient: fix the script on avr32, remove useless loop
and replace it with a '0' count value. don't ignore config file count setting git-svn-id: svn://svn.openwrt.org/openwrt/packages@10923 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@ -1,22 +1,22 @@
|
|||||||
config ntpclient
|
config ntpclient
|
||||||
option hostname '0.openwrt.pool.ntp.org'
|
option hostname '0.openwrt.pool.ntp.org'
|
||||||
option port '123'
|
option port '123'
|
||||||
option count '1'
|
option count '0'
|
||||||
|
|
||||||
config ntpclient
|
config ntpclient
|
||||||
option hostname '1.openwrt.pool.ntp.org'
|
option hostname '1.openwrt.pool.ntp.org'
|
||||||
option port '123'
|
option port '123'
|
||||||
option count '1'
|
option count '0'
|
||||||
|
|
||||||
config ntpclient
|
config ntpclient
|
||||||
option hostname '2.openwrt.pool.ntp.org'
|
option hostname '2.openwrt.pool.ntp.org'
|
||||||
option port '123'
|
option port '123'
|
||||||
option count '1'
|
option count '0'
|
||||||
|
|
||||||
config ntpclient
|
config ntpclient
|
||||||
option hostname '3.openwrt.pool.ntp.org'
|
option hostname '3.openwrt.pool.ntp.org'
|
||||||
option port '123'
|
option port '123'
|
||||||
option count '1'
|
option count '0'
|
||||||
|
|
||||||
config ntpdrift
|
config ntpdrift
|
||||||
option freq '0'
|
option freq '0'
|
||||||
|
@ -8,23 +8,15 @@ config_cb() {
|
|||||||
local cfgtype
|
local cfgtype
|
||||||
config_get cfgtype "$cfg" TYPE
|
config_get cfgtype "$cfg" TYPE
|
||||||
|
|
||||||
case "$cfgtype" in
|
if [ "$cfgtype" = ntpclient ]
|
||||||
ntpclient)
|
then
|
||||||
config_get hostname $cfg hostname
|
config_get hostname $cfg hostname
|
||||||
config_get port $cfg port
|
config_get port $cfg port
|
||||||
|
config_get count $cfg count
|
||||||
|
|
||||||
# prepare for continuos operation
|
ps | grep -q 'bin/[n]tpclient' || \
|
||||||
count=0 # unlimited
|
/usr/sbin/ntpclient -s -c ${count:-1} -l -h $hostname -p ${port:-123} 2>&- >&- &
|
||||||
ps | grep 'bin/[n]tpclient' >&- || {
|
fi
|
||||||
while true; do
|
|
||||||
ping -c 1 $hostname 2>&- >&- && {
|
|
||||||
/usr/sbin/ntpclient -c ${count:-1} -l -h $hostname -p ${port:-123} 2>&- >&- &
|
|
||||||
} && return
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
Reference in New Issue
Block a user