From 08a72cfd46cc3e251dcfae31332945e6cf535f5d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 24 Jan 2026 17:15:52 +0100 Subject: [PATCH] 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 --- board/aarch64/rootfs/usr/sbin/wan-monitor.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/board/aarch64/rootfs/usr/sbin/wan-monitor.sh b/board/aarch64/rootfs/usr/sbin/wan-monitor.sh index 16057803..37810a3c 100755 --- a/board/aarch64/rootfs/usr/sbin/wan-monitor.sh +++ b/board/aarch64/rootfs/usr/sbin/wan-monitor.sh @@ -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