From f5394120e1c852b8b2e8a3deeb33d83cda1d0e78 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 14 Feb 2026 20:30:53 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BC=98=E5=8C=96=E4=BF=9D=E5=AE=88=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=AE=88=E6=8A=A4=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/starts/start_legacy_wd.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/starts/start_legacy_wd.sh b/scripts/starts/start_legacy_wd.sh index fbc5a820..dbfbfe82 100644 --- a/scripts/starts/start_legacy_wd.sh +++ b/scripts/starts/start_legacy_wd.sh @@ -1,13 +1,16 @@ [ -z "$CRASHDIR" ] && CRASHDIR=$(cd "$(dirname "$0")"/.. && pwd) PIDFILE="/tmp/ShellCrash/$1.pid" +LOCKDIR="/tmp/ShellCrash/start_$1.lock" [ -f "$CRASHDIR"/.start_error ] && [ ! -f /tmp/ShellCrash/crash_start_time ] && exit 1 #当启动失败后禁止开机自启动 +mkdir "$LOCKDIR" 2>/dev/null || exit 1 if [ -f "$PIDFILE" ]; then PID="$(cat "$PIDFILE")" if [ -n "$PID" ] && [ "$PID" -eq "$PID" ] 2>/dev/null; then if kill -0 "$PID" 2>/dev/null || [ -d "/proc/$PID" ]; then + rm -d "$LOCKDIR" 2>/dev/null return 0 fi else @@ -16,13 +19,12 @@ if [ -f "$PIDFILE" ]; then fi #如果没有进程则拉起 -LOCKDIR="/tmp/ShellCrash/start_$1.lock" -if mkdir "$LOCKDIR" 2>/dev/null; then - if [ "$1" = "shellcrash" ]; then - "$CRASHDIR"/start.sh start - else - [ -f "$CRASHDIR/starts/start_legacy.sh" ] && . "$CRASHDIR/starts/start_legacy.sh" - start_legacy "$CRASHDIR/menus/bot_tg.sh" "$1" - fi - rm -d "$LOCKDIR" 2>/dev/null +if [ "$1" = "shellcrash" ]; then + "$CRASHDIR"/start.sh start +else + [ -f "$CRASHDIR/starts/start_legacy.sh" ] && . "$CRASHDIR/starts/start_legacy.sh" + killall bot_tg.sh 2>/dev/null + start_legacy "$CRASHDIR/menus/bot_tg.sh" "$1" fi + +rm -d "$LOCKDIR" 2>/dev/null