d2ray/ci_reload.sh

32 lines
1.4 KiB
Bash
Raw Normal View History

2021-04-19 07:51:22 +00:00
#!/bin/sh
2021-04-23 06:52:21 +00:00
set -e
2021-04-22 09:06:03 +00:00
2022-10-03 21:23:29 +00:00
apk add openssh
2021-04-19 07:51:22 +00:00
2021-04-22 09:01:45 +00:00
key=$(cat ./key)
2021-04-19 07:51:22 +00:00
2021-04-23 06:51:06 +00:00
chmod 600 ./id_root
2021-04-22 09:07:57 +00:00
2022-10-03 21:21:08 +00:00
while read -r line
do
filename="confs/$line"
echo "Conf name: $filename"
2021-04-19 07:51:22 +00:00
addr=$(basename $filename)
echo "Refreshing $addr..."
2021-04-23 06:51:06 +00:00
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker pull quackerd/d2ray:latest"
2021-04-22 09:09:33 +00:00
set +e
2021-04-23 06:51:06 +00:00
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker stop d2ray && docker rm d2ray"
2021-04-22 09:09:33 +00:00
set -e
2021-04-23 06:51:06 +00:00
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker run -d \
2022-10-03 21:21:08 +00:00
--restart unless-stopped \
-e KEY=$key \
-e FQDN=$addr \
-p 80:80 \
2022-11-03 05:08:47 +00:00
-p 443:443 \
2022-10-03 21:21:08 +00:00
-v d2ray_volume:/opt/config \
--name d2ray \
quackerd/d2ray:latest"
2021-04-23 07:06:43 +00:00
ssh -p 77 -o StrictHostKeychecking=no -i ./id_root root@$addr -t "docker system prune -af"
2022-10-03 21:21:08 +00:00
done < ./reload_list
2021-04-19 07:51:22 +00:00
wait