board: fix SIGTERM handling in wan-monitor at shutdown

When the shell is blocked on sleep, signal handlers don't execute until
the command completes.  This caused the script to ignore SIGTERM at
shutdown, forcing Finit to wait and eventually SIGKILL it instead.

Fix by running sleep in the background and using wait, which is
interruptible by signals.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-01-24 18:08:31 +01:00
parent ea076e27cc
commit 08a72cfd46
+5 -2
View File
@@ -20,6 +20,7 @@ cleanup()
{
rm -f "$LED_FILE"
rm -f "$PID_FILE"
kill %% 2>/dev/null
exit 0
}
@@ -31,11 +32,13 @@ remaining_time=$((1800 - $(awk '{print int($1)}' /proc/uptime)))
while [ "$remaining_time" -gt 0 ]; do
check_wan
sleep 1
sleep 1 &
wait $!
remaining_time=$((remaining_time - 1))
done
while :; do
check_wan
sleep 5
sleep 5 &
wait $!
done