ntpclient: fix the script on avr32, remove useless loop and replace it with a '0...
authorMatteo Croce <rootkit85@yahoo.it>
Tue, 22 Apr 2008 23:52:07 +0000 (23:52 +0000)
committerMatteo Croce <rootkit85@yahoo.it>
Tue, 22 Apr 2008 23:52:07 +0000 (23:52 +0000)
SVN-Revision: 10923

net/ntpclient/files/ntpclient.config
net/ntpclient/files/ntpclient.init

index 0d9c01041f8fffb614a128a078f99d8f4b1a3e1c..16951137801c78c3e605ce35719f9f8d171636a4 100644 (file)
@@ -1,22 +1,22 @@
 config ntpclient
        option hostname '0.openwrt.pool.ntp.org'
        option port     '123'
-       option count    '1'
+       option count    '0'
 
 config ntpclient
        option hostname '1.openwrt.pool.ntp.org'
        option port     '123'
-       option count    '1'
+       option count    '0'
 
 config ntpclient
        option hostname '2.openwrt.pool.ntp.org'
        option port     '123'
-       option count    '1'
+       option count    '0'
 
 config ntpclient
        option hostname '3.openwrt.pool.ntp.org'
        option port     '123'
-       option count    '1'
+       option count    '0'
 
 config ntpdrift
        option freq     '0'
index b9c71c559cf88464d0c3f5d2522dde958d73b1d0..7c975f695d577f3d0bf3260f73772118bd62b3a5 100644 (file)
@@ -8,23 +8,15 @@ config_cb() {
        local cfgtype
        config_get cfgtype "$cfg" TYPE
 
-       case "$cfgtype" in
-               ntpclient)
-                       config_get hostname     $cfg hostname
-                       config_get port         $cfg port
+       if [ "$cfgtype" = ntpclient ]
+       then
+               config_get hostname     $cfg hostname
+               config_get port         $cfg port
+               config_get count        $cfg count
 
-                       # prepare for continuos operation
-                       count=0 # unlimited
-                       ps | grep 'bin/[n]tpclient' >&- || {
-                               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
+               ps | grep -q 'bin/[n]tpclient' || \
+                       /usr/sbin/ntpclient -s -c ${count:-1} -l -h $hostname -p ${port:-123} 2>&- >&- &
+       fi
 }
 
 start() {