3 Commits

Author SHA1 Message Date
juewuy
65244e51da ~版本回退改为使用api链接 2026-02-14 20:48:52 +08:00
juewuy
1087f57893 Merge branch 'master' into dev 2026-02-14 20:31:11 +08:00
juewuy
f5394120e1 ~优化保守模式守护进程 2026-02-14 20:30:53 +08:00
2 changed files with 15 additions and 17 deletions

View File

@@ -1215,7 +1215,7 @@ setserver() {
separator_line "="
content_line "\033[32m正在获取版本信息......\033[0m"
. "$CRASHDIR"/libs/web_get_lite.sh
web_get_lite https://github.com/juewuy/ShellCrash/tags | grep -o 'releases/tag/.*data' | awk -F '/' '{print $3}' | sed 's/".*//g' >"$TMPDIR"/tags
list=$(web_get_lite https://api.github.com/repos/juewuy/ShellCrash/tags | grep -E '"name": "[0-9]' | cut -d '"' -f4)
if [ "$?" = "0" ]; then
content_line "\033[32m获取版本信息成功\033[0m"
separator_line "="
@@ -1223,18 +1223,14 @@ setserver() {
line_break
separator_line "="
content_line "\033[31m请选择想要回退至的具体版本\033[0m"
cat "$TMPDIR"/tags |
awk '{print NR") "$1}' |
while IFS= read -r line; do
content_line "$line"
done
list_box "$list"
btm_box "" \
"0) 返回上级菜单"
read -r -p "请输入对应标号> " num
if [ -z "$num" ] || [ "$num" = 0 ]; then
continue
elif [ "$num" -le $(cat "$TMPDIR"/tags 2>/dev/null | awk 'END{print NR}') ]; then
release_type=$(cat "$TMPDIR"/tags | awk '{print $1}' | sed -n "$num"p)
elif [ "$num" -le $(echo "$list" | awk 'END{print NR}') ]; then
release_type=$(echo "$list" | sed -n "$num"p)
update_url=''
saveserver
else

View File

@@ -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