reload sing-box instead of restart
This commit is contained in:
+12
-3
@@ -20,7 +20,17 @@ terminateSingbox()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reloadSingbox()
|
||||||
|
{
|
||||||
|
if kill -0 $tokill > /dev/null 2>&1; then
|
||||||
|
kill -HUP $tokill
|
||||||
|
else
|
||||||
|
runSingbox
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
trap terminateSingbox SIGINT SIGTERM SIGKILL
|
trap terminateSingbox SIGINT SIGTERM SIGKILL
|
||||||
|
trap reloadSingbox SIGHUP
|
||||||
|
|
||||||
runSingbox
|
runSingbox
|
||||||
|
|
||||||
@@ -37,8 +47,7 @@ do
|
|||||||
terminateSingbox
|
terminateSingbox
|
||||||
;;
|
;;
|
||||||
"restart")
|
"restart")
|
||||||
terminateSingbox
|
reloadSingbox
|
||||||
runSingbox
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -47,7 +56,7 @@ do
|
|||||||
if ! kill -0 $tokill > /dev/null 2>&1; then
|
if ! kill -0 $tokill > /dev/null 2>&1; then
|
||||||
if [ "$signal" != "stop" ]; then
|
if [ "$signal" != "stop" ]; then
|
||||||
echo "Sing-Box with PID $tokill crashed. Breaking the loop..."
|
echo "Sing-Box with PID $tokill crashed. Breaking the loop..."
|
||||||
break
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
Reference in New Issue
Block a user