mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
~修复保守模式部分情况下反复重启的bug
This commit is contained in:
@@ -1,20 +1,28 @@
|
|||||||
|
|
||||||
[ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd)
|
[ -z "$CRASHDIR" ] && CRASHDIR=$(cd "$(dirname "$0")"/.. && pwd)
|
||||||
PIDFILE="/tmp/ShellCrash/$1.pid"
|
PIDFILE="/tmp/ShellCrash/$1.pid"
|
||||||
|
|
||||||
[ -f "$CRASHDIR"/.start_error ] && [ ! -f /tmp/ShellCrash/crash_start_time ] && exit 1 #当启动失败后禁止开机自启动
|
[ -f "$CRASHDIR"/.start_error ] && [ ! -f /tmp/ShellCrash/crash_start_time ] && exit 1 #当启动失败后禁止开机自启动
|
||||||
|
|
||||||
if [ -f "$PIDFILE" ]; then
|
if [ -f "$PIDFILE" ]; then
|
||||||
PID="$(cat "$PIDFILE")"
|
PID="$(cat "$PIDFILE")"
|
||||||
if [ -n "$PID" ] && [ -d "/proc/$PID" ]; then
|
if [ -n "$PID" ] && [ "$PID" -eq "$PID" ] 2>/dev/null; then
|
||||||
return 0
|
if kill -0 "$PID" 2>/dev/null || [ -d "/proc/$PID" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -f "$PIDFILE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#如果没有进程则拉起
|
#如果没有进程则拉起
|
||||||
if [ "$1" = shellcrash ];then
|
LOCKDIR="/tmp/ShellCrash/start_$1.lock"
|
||||||
"$CRASHDIR"/start.sh start
|
if mkdir "$LOCKDIR" 2>/dev/null; then
|
||||||
else
|
if [ "$1" = "shellcrash" ]; then
|
||||||
. "$CRASHDIR"/starts/start_legacy.sh
|
"$CRASHDIR"/start.sh start
|
||||||
start_legacy "$CRASHDIR/menus/bot_tg.sh" "$1"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Reference in New Issue
Block a user