From 87fccf73c0f5da1ae2ac805bb526bb07e818c50d Mon Sep 17 00:00:00 2001 From: wanhebin Date: Fri, 3 Mar 2023 12:59:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=98=E9=87=8F=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=96=B9=E5=BC=8F=EF=BC=9Astart.sh=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=B0=86=E4=BB=8E.env=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=8A=A0=E8=BD=BDclash=20url=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 ++ start.sh | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..ec3b556 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +# Clash 订阅地址 +export CLASH_URL='更改为你的clash订阅地址' diff --git a/start.sh b/start.sh index f0deae1..9033dc7 100755 --- a/start.sh +++ b/start.sh @@ -3,6 +3,17 @@ # 加载系统函数库(Only for RHEL Linux) # [ -f /etc/init.d/functions ] && source /etc/init.d/functions +# 获取脚本工作目录绝对路径 +Server_Dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) + +# 加载.env变量文件 +source $Server_Dir/.env + +Conf_Dir="$Server_Dir/conf" +Temp_Dir="$Server_Dir/temp" +Log_Dir="$Server_Dir/logs" +URL=${CLASH_URL} + # 自定义action函数,实现通用action功能 success() { echo -en "\\033[60G[\\033[1;32m OK \\033[0;39m]\r" @@ -39,12 +50,6 @@ if_success() { fi } -Server_Dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) -Conf_Dir="$Server_Dir/conf" -Temp_Dir="$Server_Dir/temp" -Log_Dir="$Server_Dir/logs" -URL='更改为你的clash订阅地址' - # 临时取消环境变量 unset http_proxy unset https_proxy