mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-02-04 10:11:28 +08:00
scripts\install_systemd.sh shutdown.sh start.sh
This commit is contained in:
@ -7,12 +7,14 @@ Temp_Dir="$Server_Dir/temp"
|
||||
Conf_Dir="$Server_Dir/conf"
|
||||
PID_FILE="$Temp_Dir/clash.pid"
|
||||
|
||||
mkdir -p "$Temp_Dir"
|
||||
|
||||
# 1) 优先按 PID_FILE 停
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID="$(cat "$PID_FILE" 2>/dev/null || true)"
|
||||
if [ -n "${PID:-}" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
kill "$PID" 2>/dev/null || true
|
||||
for _ in {1..5}; do
|
||||
for _ in {1..8}; do
|
||||
sleep 1
|
||||
if ! kill -0 "$PID" 2>/dev/null; then
|
||||
break
|
||||
@ -29,7 +31,7 @@ else
|
||||
PIDS="$(pgrep -f " -d ${Conf_Dir}(\s|$)" || true)"
|
||||
if [ -n "${PIDS:-}" ]; then
|
||||
kill $PIDS 2>/dev/null || true
|
||||
for _ in {1..5}; do
|
||||
for _ in {1..8}; do
|
||||
sleep 1
|
||||
if ! pgrep -f " -d ${Conf_Dir}(\s|$)" >/dev/null 2>&1; then
|
||||
break
|
||||
@ -57,4 +59,4 @@ if [ "$Env_File" != "off" ] && [ "$Env_File" != "disabled" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "\n服务关闭成功。若当前终端已开启代理,请执行:proxy_off\n"
|
||||
echo -e "\n服务关闭成功。若当前终端已开启代理,请执行:proxy_off\n"
|
||||
Reference in New Issue
Block a user