~脚本拆分后bug修复

This commit is contained in:
juewuy
2025-12-25 21:49:05 +08:00
parent a1835b7113
commit d1c9bccfbe
9 changed files with 247 additions and 17 deletions

View File

@@ -151,13 +151,15 @@ set_bot_tg_init(){
fi
}
set_bot_tg_service(){
PID=$(pidof /bin/sh "$CRASHDIR"/menus/bot_tg.sh)
if [ "$bot_tg_service" = ON ];then
bot_tg_service=OFF
[ -n "$PID" ] && kill -9 $PID >/dev/null 2>&1
[ -f "$TMPDIR/bot_tg.pid" ] && kill -TERM -"$(cat "$TMPDIR/bot_tg.pid")" && rm -f "$TMPDIR/bot_tg.pid"
else
bot_tg_service=ON
[ -n "$(pidof CrashCore)" ] && [ -z "$PID" ] && "$CRASHDIR"/menus/bot_tg.sh &
[ -n "$(pidof CrashCore)" ] && {
setsid sh "$CRASHDIR/menus/bot_tg.sh" &
echo $! > "$TMPDIR/bot_tg.pid"
}
fi
setconfig bot_tg_service "$bot_tg_service"
}