mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user