~优化测试相关命令

~优化版本回退功能,现在支持回退到近期tags
~修复保守模式停止服务时未正确注销防火墙的bug
~修复小米设备因安装在u盘等导致自启命令不正确的bug

# Conflicts:
#	scripts/menu.sh
#	scripts/menus/9_upgrade.sh
This commit is contained in:
juewuy
2026-01-21 19:05:40 +08:00
parent a80c5b5c42
commit 9b7c5e658c
2 changed files with 15 additions and 10 deletions

View File

@@ -72,9 +72,10 @@ stop)
cronset '运行时每' cronset '运行时每'
cronset '流媒体预解析' cronset '流媒体预解析'
#多种方式结束进程 #多种方式结束进程
if [ -f "$TMPDIR/shellcrash.pid" ];then if [ -f "$TMPDIR/shellcrash.pid" ];then
kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" kill -TERM "$(cat "$TMPDIR/shellcrash.pid")"
rm -f "$TMPDIR/shellcrash.pid" rm -f "$TMPDIR/shellcrash.pid"
stop_firewall
elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then
systemctl stop shellcrash.service >/dev/null 2>&1 systemctl stop shellcrash.service >/dev/null 2>&1
elif [ -f /etc/rc.common ] && grep -q 'procd' /proc/1/comm; then elif [ -f /etc/rc.common ] && grep -q 'procd' /proc/1/comm; then
@@ -85,7 +86,7 @@ stop)
elif rc-status -r >/dev/null 2>&1; then elif rc-status -r >/dev/null 2>&1; then
rc-service shellcrash stop >/dev/null 2>&1 rc-service shellcrash stop >/dev/null 2>&1
else else
stop_firewall #清理路由策略 stop_firewall
fi fi
killall CrashCore 2>/dev/null killall CrashCore 2>/dev/null
#清理缓存目录 #清理缓存目录
@@ -115,8 +116,8 @@ debug)
else else
sed -i "s/log-level: info/log-level: $2/" "$TMPDIR"/config.yaml sed -i "s/log-level: info/log-level: $2/" "$TMPDIR"/config.yaml
fi fi
[ "$3" = flash ] && dir=$CRASHDIR || dir=$TMPDIR [ "$3" = flash ] && dir="$CRASHDIR" || dir="$TMPDIR"
$COMMAND >${dir}/debug.log 2>&1 & $COMMAND >"$dir"/debug.log 2>&1 &
sleep 2 sleep 2
logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33 logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33
else else

View File

@@ -1,9 +1,14 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts\/snapshot_init.sh//')" CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts.*//')"
i=0
[ -f "$CRASHDIR"/configs/ShellCrash.cfg ] && . "$CRASHDIR"/configs/ShellCrash.cfg while [ ! -f "$CRASHDIR/configs/ShellCrash.cfg" ]; do
[ $i -gt 20 ] && exit 1
i=$((i + 1))
sleep 3
done
. "$CRASHDIR"/configs/ShellCrash.cfg
autoSSH(){ autoSSH(){
#自动开启SSH #自动开启SSH
@@ -78,7 +83,6 @@ init(){
while ! ip a| grep -q lan; do while ! ip a| grep -q lan; do
sleep 10 sleep 10
done done
sleep 20
autoSSH #软固化功能 autoSSH #软固化功能
auto_clean #自动清理 auto_clean #自动清理
[ -s "$CRASHDIR"/start.sh ] && auto_start [ -s "$CRASHDIR"/start.sh ] && auto_start