删除验证配置文件逻辑
This commit is contained in:
parent
9de686ad28
commit
0cb300ea5c
23
bin/run.sh
23
bin/run.sh
@ -3,34 +3,15 @@
|
|||||||
|
|
||||||
run() {
|
run() {
|
||||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
local config_dir=$(readlink -f "$script_dir/../config")
|
local compose_file="$script_dir/../docker-compose.yml"
|
||||||
local config_file="$config_dir/config.json"
|
|
||||||
|
|
||||||
source "$script_dir/utils/base.sh"
|
|
||||||
|
|
||||||
# 检查jq是否安装
|
|
||||||
check_jq
|
|
||||||
|
|
||||||
# 检查bash是否安装
|
|
||||||
check_bash_installed
|
|
||||||
|
|
||||||
# 如果配置没有创建
|
|
||||||
if [ ! -e "$config_file" ]; then
|
|
||||||
touch "$config_file"
|
|
||||||
fi
|
|
||||||
local password=$(jq -r '.auth.password' "$config_file")
|
|
||||||
if [ ! -s "$config_file" ] || [ "$password" = "你的密码" ]; then
|
|
||||||
bash "$script_dir/create_config.sh" # 创建配置
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 如果容器已经启动, 则先停止容器
|
# 如果容器已经启动, 则先停止容器
|
||||||
local compose_file="$script_dir/../docker-compose.yml"
|
|
||||||
if docker-compose -f "$compose_file" ps | grep -q "Up"; then
|
if docker-compose -f "$compose_file" ps | grep -q "Up"; then
|
||||||
docker-compose -f "$compose_file" down
|
docker-compose -f "$compose_file" down
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 启动docker容器
|
# 启动docker容器
|
||||||
docker-compose -f "$script_dir/../docker-compose.yml" up -d
|
docker-compose -f "$compose_file" up -d
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user