summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoxMax <50133316+NoxMax@users.noreply.github.com>2025-08-06 00:48:48 -0600
committerGitHub <noreply@github.com>2025-08-06 08:48:48 +0200
commitc7351be94a6f8b81a6ba8b26e92c0643844258dd (patch)
treebf510de65a3793ee88c6b112295fbf327c213af2
parent5717cd358cb44ec2473154f85a1c88f585702773 (diff)
fix(bash): Exit simple-restarter script if shutdown is requested (#22617)
-rwxr-xr-xapps/startup-scripts/src/simple-restarter10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/startup-scripts/src/simple-restarter b/apps/startup-scripts/src/simple-restarter
index 62aea7fbd7..a158b38bef 100755
--- a/apps/startup-scripts/src/simple-restarter
+++ b/apps/startup-scripts/src/simple-restarter
@@ -66,7 +66,7 @@ while true; do
echo "$(basename "$BINARY") terminated after $DIFFERENCE seconds, restart count: $_restart_count"
# Crash loop detection
- if [ $DIFFERENCE -lt 10 ]; then
+ if [ "$DIFFERENCE" -lt 10 ]; then
# Increment instant crash count if runtime is lower than 10 seconds
((_instant_crash_count++))
echo "Warning: Quick restart detected ($DIFFERENCE seconds) - instant crash count: $_instant_crash_count"
@@ -76,11 +76,17 @@ while true; do
fi
# Prevent infinite crash loops
- if [ $_instant_crash_count -gt 5 ]; then
+ if [ "$_instant_crash_count" -gt 5 ]; then
echo "Error: $(basename "$BINARY") restarter exited. Infinite crash loop prevented (6 crashes in under 10 seconds each)"
echo "Please check your system configuration and logs"
exit 1
fi
+
+ # Exit cleanly if shutdown was requested by command or SIGINT (exit code 0)
+ if [ "$_exit_code" -eq 0 ]; then
+ echo "$(basename "$BINARY") shutdown safely"
+ exit 0
+ fi
echo "$(basename "$BINARY") will restart in 3 seconds..."
sleep 3