quicktun: Improve QuickTun init script
authorVasilis Tsiligiannis <acinonyx@openwrt.gr>
Tue, 5 Apr 2011 16:37:16 +0000 (16:37 +0000)
committerVasilis Tsiligiannis <acinonyx@openwrt.gr>
Tue, 5 Apr 2011 16:37:16 +0000 (16:37 +0000)
The new init script won't fail if quicktun takes more than 1 second to start.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
SVN-Revision: 26488

net/quicktun/files/quicktun.init

index ae7bdd662741b9b3e8cd4ce53e76e687e0acb8a5..82caa26f049ea77092c78a1aadeb0eef6691d5e5 100644 (file)
@@ -60,12 +60,14 @@ start_service() {
 
        eval env $OPTS "$SSD" -q -b -p "$PID" -m -x "$BIN" -S
 
-       sleep 1
+       while ! ifconfig "$interface" >/dev/null 2>&1; do
+               if ! $SSD -t -q -p $PID -x $BIN -K; then
+                       echo "$s: daemon startup failed"
+                       return 1
+               fi
 
-       if ! ifconfig "$interface" >/dev/null 2>&1; then
-               echo "$s: daemon startup failed"
-               return 1
-       fi
+               sleep 1
+       done
 
        config_get up "$s" up
        [ -n "$up" ] && sh -c "$up" - "$interface"