reload sing-box instead of restart

This commit is contained in:
Alireza Ahmadi
2024-07-07 23:37:03 +02:00
parent 96564f1f86
commit cb4a7fe6df
+12 -3
View File
@@ -20,7 +20,17 @@ terminateSingbox()
fi
}
reloadSingbox()
{
if kill -0 $tokill > /dev/null 2>&1; then
kill -HUP $tokill
else
runSingbox
fi
}
trap terminateSingbox SIGINT SIGTERM SIGKILL
trap reloadSingbox SIGHUP
runSingbox
@@ -37,8 +47,7 @@ do
terminateSingbox
;;
"restart")
terminateSingbox
runSingbox
reloadSingbox
;;
esac
fi
@@ -47,7 +56,7 @@ do
if ! kill -0 $tokill > /dev/null 2>&1; then
if [ "$signal" != "stop" ]; then
echo "Sing-Box with PID $tokill crashed. Breaking the loop..."
break
exit 1
fi
fi
done