websoft9/docker/apphub/config/entrypoint.sh

33 lines
780 B
Bash
Raw Normal View History

2023-09-18 17:13:15 +08:00
#!/bin/bash
2023-09-23 14:28:03 +08:00
# check credentials exists
2023-09-19 18:53:05 +08:00
check_file_exists() {
file_path=$1
max_attempts=$2
2023-09-19 15:40:14 +08:00
2023-09-19 18:53:05 +08:00
for ((i=1; i<=max_attempts; i++))
do
if [ -f "$file_path" ]; then
echo "$file_path exists"
2023-09-23 14:28:03 +08:00
return 0
2023-09-19 18:53:05 +08:00
else
echo "$file_path is not exists, wait a moment.."
fi
2023-09-21 17:26:14 +08:00
sleep 1
2023-09-19 18:53:05 +08:00
if ((i==max_attempts)); then
2023-09-19 19:42:44 +08:00
echo "$file_path is not exists, app may be work normally."
2023-09-23 14:28:03 +08:00
return 1
2023-09-19 18:53:05 +08:00
fi
done
}
2023-09-19 15:40:14 +08:00
2023-09-23 14:28:03 +08:00
set +e
check_file_exists "/websoft9/credentials/credential_proxy" 1
check_file_exists "/websoft9/credentials/credential_deployment" 1
check_file_exists "/websoft9/credentials/credential_git" 1
set -e
2023-09-18 17:13:15 +08:00
2023-09-19 18:53:05 +08:00
# start by supervisord
2023-09-20 11:34:22 +08:00
/usr/bin/supervisord
2023-09-18 17:13:15 +08:00
supervisorctl start all
2023-09-19 14:32:20 +08:00
tail -f /dev/null