]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
improve check_process() in start_test_stop 879/head
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 25 Jun 2013 20:12:44 +0000 (22:12 +0200)
committermind04 <mind04@monshouwer.org>
Wed, 26 Jun 2013 08:51:06 +0000 (10:51 +0200)
regression-tests/start-test-stop

index 250343310c256d42641300da70d4470b97eadc5a..a75f38e7eccc1f0dd31fb905f33f7bae230e69fc 100755 (executable)
@@ -31,7 +31,7 @@ bindwait ()
        done
 
        if [ $done != $domcount ]; then
-          echo "Domain parsing failed" >> failed_tests
+               echo "Domain parsing failed" >> failed_tests
        fi
 }
 
@@ -58,29 +58,32 @@ securezone ()
 
 check_process ()
 {
-   sleep 1
-   set +e
-   pids=$(cat pdns*.pid 2>/dev/null)
-   if [ -z "$pids" ]; then
-        echo "PowerDNS did not start"
-        exit 1
-   fi
-   kill -0 $pids >/dev/null 2>&1  
-   if [ $? -ne 0 ]; then
-        echo "PowerDNS did not start"
-        exit 1
-   fi
-   set -e
+       set +e
+       loopcount=0
+       while [ $loopcount -lt 5 ]; do
+               sleep 1
+               pids=$(cat pdns*.pid 2>/dev/null)
+               if [ ! -z "$pids" ]; then
+                       kill -0 $pids >/dev/null 2>&1
+                       if [ $? -eq 0 ]; then
+                               set -e
+                               return
+                       fi
+               fi
+       let loopcount=loopcount+1
+       done
+       echo "PowerDNS did not start"
+       exit 1
 }
 
 if [ ! -x $PDNS ]; then
-   echo "$PDNS is not executable binary"
-   exit 1
+       echo "$PDNS is not executable binary"
+       exit 1
 fi
 
 if [ ! -x $PDNS2 ]; then
-   echo "$PDNS2 is not executable binary"
-   exit 1
+       echo "$PDNS2 is not executable binary"
+       exit 1
 fi
 
 port=$1