From 34e4cbf8f0ddc9ccf39ea3f47d14d575a395236e Mon Sep 17 00:00:00 2001 From: wnlen <62139570+wnlen@users.noreply.github.com> Date: Fri, 20 Mar 2026 15:32:23 +0800 Subject: [PATCH] Update start.sh --- start.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/start.sh b/start.sh index 3f0b8cf..b2ae3cf 100644 --- a/start.sh +++ b/start.sh @@ -19,6 +19,21 @@ trap 'rc=$?; echo "[ERR] rc=$rc line=$LINENO cmd=$BASH_COMMAND" >&2' ERR #################### 脚本初始化任务 #################### +# 启动模式参数 +ONLY_GENERATE="${ONLY_GENERATE:-false}" + +for arg in "$@"; do + case "$arg" in + --only-generate) + ONLY_GENERATE="true" + ;; + -h|--help) + echo "Usage: bash start.sh [--only-generate]" + exit 0 + ;; + esac +done + # 获取脚本工作目录绝对路径 export Server_Dir Server_Dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -895,6 +910,11 @@ touch "$RUNTIME_DIR/.write_test" 2>/dev/null || { } rm -f "$RUNTIME_DIR/.write_test" 2>/dev/null || true +if [ "$ONLY_GENERATE" = "true" ]; then + echo "[INFO] config generated only, skip starting clash" + exit 0 +fi + echo -e '\n正在启动Clash服务...' Text5="服务启动成功!" Text6="服务启动失败!"