diff --git a/scripts/start.sh b/scripts/start.sh index e046040f..e9ee6403 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -72,9 +72,10 @@ stop) cronset '运行时每' cronset '流媒体预解析' #多种方式结束进程 - if [ -f "$TMPDIR/shellcrash.pid" ];then - kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" - rm -f "$TMPDIR/shellcrash.pid" + if [ -f "$TMPDIR/shellcrash.pid" ];then + kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" + rm -f "$TMPDIR/shellcrash.pid" + stop_firewall elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then systemctl stop shellcrash.service >/dev/null 2>&1 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 rc-service shellcrash stop >/dev/null 2>&1 else - stop_firewall #清理路由策略 + stop_firewall fi killall CrashCore 2>/dev/null #清理缓存目录 @@ -115,8 +116,8 @@ debug) else sed -i "s/log-level: info/log-level: $2/" "$TMPDIR"/config.yaml fi - [ "$3" = flash ] && dir=$CRASHDIR || dir=$TMPDIR - $COMMAND >${dir}/debug.log 2>&1 & + [ "$3" = flash ] && dir="$CRASHDIR" || dir="$TMPDIR" + $COMMAND >"$dir"/debug.log 2>&1 & sleep 2 logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33 else diff --git a/scripts/starts/snapshot_init.sh b/scripts/starts/snapshot_init.sh index 0d566b34..f578cfd3 100644 --- a/scripts/starts/snapshot_init.sh +++ b/scripts/starts/snapshot_init.sh @@ -1,9 +1,14 @@ #!/bin/sh # Copyright (C) Juewuy -CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts\/snapshot_init.sh//')" - -[ -f "$CRASHDIR"/configs/ShellCrash.cfg ] && . "$CRASHDIR"/configs/ShellCrash.cfg +CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts.*//')" +i=0 +while [ ! -f "$CRASHDIR/configs/ShellCrash.cfg" ]; do + [ $i -gt 20 ] && exit 1 + i=$((i + 1)) + sleep 3 +done +. "$CRASHDIR"/configs/ShellCrash.cfg autoSSH(){ #自动开启SSH @@ -78,7 +83,6 @@ init(){ while ! ip a| grep -q lan; do sleep 10 done - sleep 20 autoSSH #软固化功能 auto_clean #自动清理 [ -s "$CRASHDIR"/start.sh ] && auto_start