test: slay must wait up to five seconds before giving up

Default max delay before restarting a crashing service is five seconds.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-11-06 13:54:55 +01:00
1 parent fb86042cb3
commit d5f542dcca
1 file changed
+10 -3
+10 -3
View File
@@ -28,10 +28,16 @@ if [ -f oldpid ]; then
fi fi
fi fi
if [ "$pid" -le 1 ]; then timeout=50
sleep 3 while [ "$pid" -le 1 ]; do
sleep 0.1
pid=$(getpid "$nm") pid=$(getpid "$nm")
if [ "$pid" -le 1 ]; then if [ "$pid" -le 1 ]; then
timeout=$((timeout - 1))
if [ "$timeout" -gt 0 ]; then
continue
fi
echo "Got a bad PID: $pid, aborting ..." echo "Got a bad PID: $pid, aborting ..."
ps ps
sleep 1 sleep 1
@@ -39,7 +45,8 @@ if [ "$pid" -le 1 ]; then
ps ps
exit 1 exit 1
fi fi
fi break
done
echo "$pid" > oldpid echo "$pid" > oldpid