test: don't slay a service Finit has given up on

Once it gives up it forks the post:script and reports that PID as the
service's, so a slay still waiting for the service to come back killed
the script instead, and crashing.sh lost the /tmp/post it checks for.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-08-16 22:03:36 +02:00
parent 864a13460c
commit 8138b402a0
+7
View File
@@ -30,6 +30,13 @@ fi
timeout=50
while [ "$pid" -le 1 ]; do
sleep 0.1
# Once Finit gives up on a service it forks the post:script and
# reports that PID as the service's, so a slay still waiting for
# the service to come back would kill the script instead.
st=$(initctl -p status "$nm" 2>/dev/null | awk '/Status/{print $3}')
if [ "$st" = "crashed" ]; then
exit 1
fi
pid=$(getpid "$nm")
if [ "$pid" -le 1 ]; then
timeout=$((timeout - 1))