增加启动脚本, 初始化脚本不再打印分享链接,
This commit is contained in:
parent
b80d7dc367
commit
544eb665b8
17
bin/init.sh
17
bin/init.sh
@ -2,8 +2,18 @@
|
|||||||
|
|
||||||
# 检查 jq 是否安装
|
# 检查 jq 是否安装
|
||||||
if ! command -v jq &> /dev/null; then
|
if ! command -v jq &> /dev/null; then
|
||||||
echo "jq 未安装"
|
echo "jq 未安装, 安装 jq"
|
||||||
exit 1
|
|
||||||
|
# 如果是ubuntu系统安装jq
|
||||||
|
if [ -f /etc/lsb-release ]; then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y jq
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 如果是centos系统安装jq
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
sudo yum install -y jq
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||||
@ -13,6 +23,3 @@ bash $script_dir/update_uuid.sh
|
|||||||
|
|
||||||
# 生成密钥对, 修改config.json中的密钥属性
|
# 生成密钥对, 修改config.json中的密钥属性
|
||||||
bash $script_dir/update_key.sh
|
bash $script_dir/update_key.sh
|
||||||
|
|
||||||
# 打印分享链接
|
|
||||||
bash $script_dir/print_share_link.sh
|
|
||||||
|
|||||||
18
bin/run.sh
Normal file
18
bin/run.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||||
|
config_dir=$(readlink -f "$script_dir/../conf") # 配置文件绝对路径
|
||||||
|
|
||||||
|
uuid=$(jq -r '.inbounds[0].settings.clients[0].id' $config_dir/config.json)
|
||||||
|
|
||||||
|
# 如果配置未初始化
|
||||||
|
if [ $uuid = "你的UUID" ]; then
|
||||||
|
# 执行初始化脚本
|
||||||
|
bash $script_dir/init.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
## 启动docker容器
|
||||||
|
docker-compose up -d -f $script_dir/../docker-compose.yml
|
||||||
|
|
||||||
|
# 打印分享链接
|
||||||
|
bash $script_dir/print_share_link.sh
|
||||||
Loading…
Reference in New Issue
Block a user