-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathup.sh
executable file
·51 lines (44 loc) · 1.27 KB
/
up.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
dir_config="configs"
url_file=".secret"
#==========Check File
# if don't exist configs direcoty will be created for save clash cofig
if [ ! -d "$dir_config" ]; then
mkdir "$dir_config"
echo "create $dir_config"
fi
if [ ! -f "$url_file" ]; then
echo "Please crate .secret file"
exit
fi
workdir=$(echo ${PWD})
#==========Start Dokcer Containers
#docker container Names
convert_container="subconverter"
clash_container="clash"
# Check convert server status
if docker ps --format '{{.Names}}' | grep -q "^$convert_container\$"; then
echo "Container $convert_container is running"
else
echo "Container $convert_container is not running"
echo "Will up the convert container..."
# up convert container
docker compose -f ./docker-compose-subconverter.yml up -d
fi
sleep 1
# Get clash config
python3 ./ParseSubscribe.py
# Detect whether the config file is successfully downloaded
if [ $? -eq 0 ]; then
docker compose -f ./docker-compose-subconverter.yml down
#Detect whether the clash container is running
if docker ps --format '{{.Names}}' | grep -q "^$clash_container\$"; then
echo "Container $clash_container is running"
else
echo "Up clash container..."
docker compose -f docker-compose.yml up -d
source crontab_add_task.sh
fi
else
echo "Parse Subscription Error"
fi