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
2022-11-06 13:54:55 +01:00
parent fb86042cb3
commit d5f542dcca
+10 -3
View File
@@ -28,10 +28,16 @@ if [ -f oldpid ]; then
fi
fi
if [ "$pid" -le 1 ]; then
sleep 3
timeout=50
while [ "$pid" -le 1 ]; do
sleep 0.1
pid=$(getpid "$nm")
if [ "$pid" -le 1 ]; then
timeout=$((timeout - 1))
if [ "$timeout" -gt 0 ]; then
continue
fi
echo "Got a bad PID: $pid, aborting ..."
ps
sleep 1
@@ -39,7 +45,8 @@ if [ "$pid" -le 1 ]; then
ps
exit 1
fi
fi
break
done
echo "$pid" > oldpid