mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-03-21 22:06:45 +08:00
Update start.sh
This commit is contained in:
20
start.sh
20
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="服务启动失败!"
|
||||
|
||||
Reference in New Issue
Block a user