From 2d78583b5aecccb0da0148a816bc1495a284509f Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:27:04 +0800 Subject: [PATCH] fix test run --- sing-box.sh | 2 +- src/core.sh | 6 +++--- src/init.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sing-box.sh b/sing-box.sh index 8177cfc..0c11fb1 100644 --- a/sing-box.sh +++ b/sing-box.sh @@ -1,6 +1,6 @@ #!/bin/bash args=$@ -is_sh_ver=v1.17 +is_sh_ver=v1.18 . /etc/sing-box/sh/src/init.sh \ No newline at end of file diff --git a/src/core.sh b/src/core.sh index 939773f..ae2ab8d 100644 --- a/src/core.sh +++ b/src/core.sh @@ -771,7 +771,7 @@ manage() { fi [[ $is_test_run && ! $is_new_install ]] && { sleep 2 - if [[ ! $(pgrep -f $is_run_bin 2>/dev/null || grep -l "$is_run_bin" /proc/*/cmdline 2>/dev/null) ]]; then + if [[ ! $(pgrep -f $is_run_bin) ]]; then is_run_fail=${is_do_name_msg,,} [[ ! $is_no_manage_msg ]] && { msg @@ -1324,7 +1324,7 @@ get() { } fi is_no_manage_msg=1 - if [[ ! $(pgrep -f $is_core_bin 2>/dev/null || grep -l "$is_core_bin" /proc/*/cmdline 2>/dev/null) ]]; then + if [[ ! $(pgrep -f $is_core_bin) ]]; then _yellow "\n测试运行 $is_core_name ..\n" manage start &>/dev/null if [[ $is_run_fail == $is_core ]]; then @@ -1337,7 +1337,7 @@ get() { _green "\n$is_core_name 正在运行, 跳过测试\n" fi if [[ $is_caddy ]]; then - if [[ ! $(pgrep -f $is_caddy_bin 2>/dev/null || grep -l "$is_caddy_bin" /proc/*/cmdline 2>/dev/null) ]]; then + if [[ ! $(pgrep -f $is_caddy_bin) ]]; then _yellow "\n测试运行 Caddy ..\n" manage start caddy &>/dev/null if [[ $is_run_fail == 'caddy' ]]; then diff --git a/src/init.sh b/src/init.sh index c668c99..76204a8 100644 --- a/src/init.sh +++ b/src/init.sh @@ -115,7 +115,7 @@ is_tls_key=$is_core_dir/bin/tls.key rm $is_tls_tmp } -if [[ $(pgrep -f $is_core_bin 2>/dev/null || grep -l "$is_core_bin" /proc/*/cmdline 2>/dev/null) ]]; then +if [[ $(pgrep -f $is_core_bin) ]]; then is_core_status=$(_green running) else is_core_status=$(_red_bg stopped) @@ -135,7 +135,7 @@ if [[ -f $is_caddy_bin && -d $is_caddy_dir && $is_caddy_service ]]; then is_tmp_https_port=$(grep -E '^ {2,}https_port|^https_port' $is_caddyfile | grep -E -o [0-9]+) [[ $is_tmp_http_port ]] && is_http_port=$is_tmp_http_port [[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port - if [[ $(pgrep -f $is_caddy_bin 2>/dev/null || grep -l "$is_caddy_bin" /proc/*/cmdline 2>/dev/null) ]]; then + if [[ $(pgrep -f $is_caddy_bin) ]]; then is_caddy_status=$(_green running) else is_caddy_status=$(_red_bg stopped)