From a90c96073fa123f99a4bdb55d424751b302fc80e Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 20 Dec 2018 10:44:58 +0000
Subject: [PATCH] Task SW-564: Allow 20s for pid file to appear instead of 1s

---
 SubSystems/Online_Cobalt/test/tstartBGL.run | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/SubSystems/Online_Cobalt/test/tstartBGL.run b/SubSystems/Online_Cobalt/test/tstartBGL.run
index 800d5ddf1ce..a50c54de596 100755
--- a/SubSystems/Online_Cobalt/test/tstartBGL.run
+++ b/SubSystems/Online_Cobalt/test/tstartBGL.run
@@ -67,8 +67,13 @@ for cluster in CEP4 DRAGNET; do  # all in cobalt_functions.sh as used by runObse
 
   # PID file is created by runObservation.sh, which is started in the background. Although the PID file
   # is created almost immediately, we may be too fast if we check without waiting.
-  # Used 'nice -n 5' to dramatically increase the chance that we check before the pid file is removed again.
-  sleep 1
+  # PID file must appear within 20s
+  TIMEOUT=20
+  while [ "$TIMEOUT" -gt 0 -a ! -e $LOFARROOT/var/run/rtcp-1000.pid ]
+  do
+    sleep 1
+    TIMEOUT=$((TIMEOUT - 1))
+  done
   [ -e $LOFARROOT/var/run/rtcp-1000.pid ] || error "Found no $LOFARROOT/var/run/rtcp-1000.pid"
 
   # PID file must be gone after 20s
-- 
GitLab