websoft9/systemd/send_credentials.sh

27 lines
931 B
Bash
Raw Normal View History

2023-09-19 15:40:14 +08:00
#!/bin/bash
set -e
trap "sleep 1; continue" ERR
2023-09-20 14:44:46 +08:00
while true; do
2023-09-20 14:56:48 +08:00
set +e
2023-09-20 17:10:32 +08:00
echo "copy git credential"
2023-09-20 15:08:31 +08:00
docker cp websoft9-git:/var/websoft9/credential /data/websoft9/credential_git
docker cp /data/websoft9/credential_git websoft9-apphub:/websoft9/credentials
2023-09-20 17:10:32 +08:00
echo "copy deployment credential"
2023-09-20 15:08:31 +08:00
docker cp websoft9-deployment:/var/websoft9/credential /data/websoft9/credential_deployment
2023-09-20 17:05:09 +08:00
content=$(cat /data/websoft9/credential_deployment)
username="admin"
2023-09-20 17:20:48 +08:00
json="{\"username\":\"$username\",\"password\":\"$content\"}"
2023-09-20 17:05:09 +08:00
echo "$json" > /data/websoft9/credential_deployment
2023-09-20 15:08:31 +08:00
docker cp /data/websoft9/credential_deployment websoft9-apphub:/websoft9/credentials
2023-09-20 17:10:32 +08:00
echo "wait nginx..."
2023-09-20 15:08:31 +08:00
docker cp websoft9-proxy:/var/websoft9/credential /data/websoft9/credential_proxy
docker cp /data/websoft9/credential_proxy websoft9-apphub:/websoft9/credentials
2023-09-20 14:56:48 +08:00
set -e
2023-09-20 14:44:46 +08:00
sleep 3
2023-09-19 15:40:14 +08:00
done