Minor bugfixes.

This commit is contained in:
2021-09-03 06:50:34 +00:00
parent 6388f36687
commit eb82f0a86b
2 changed files with 16 additions and 10 deletions

View File

@@ -15,10 +15,12 @@ service_exec="docker run --rm \
letsencrypt_certificates() {
echo "XYZ: "$PROXY_SERVICE_FILE" "$ROLE
local RUNNING_CONTAINERS;
cd /
# Check services with running containers by roles
for CONTAINER in $(jq -r --arg ROLE $ROLE '.containers[] | select(.ROLES==$ROLE)' $PROXY_SERVICE_FILE | jq -r .NAME) ; do
for CONTAINER in $(jq -r --arg ROLE $ROLE '.containers[] | select(.ROLES==$ROLE)' /$PROXY_SERVICE_FILE | jq -r .NAME) ; do
UP=$(docker ps | grep $CONTAINER | grep Up | wc -l)
RUNNING_CONTAINERS=$((RUNNING_CONTAINERS + UP))
done;

View File

@@ -30,7 +30,7 @@ do_proxy_restart() {
for retries in $(seq 0 $((RESTART + 1))); do
if [[ $retries -le $RESTART ]] ; then
echo "Proxy "$PROXY_NAME" restarting in progress";
docker stop $proxies;
docker stop $PROXY_NAME;
sleep $TIMEOUT;
$service_exec $SERVICE_NAME.containers.$PROXY_NAME start
if docker ps | grep $PROXY_NAME ; then
@@ -95,6 +95,7 @@ if [[ "$RUNNING_CONTAINERS" == "$CONTAINERS_BY_ROLE" || "$RUNNING_CONTAINERS" -g
elif [[ "$RUNNING_CONTAINERS" -eq 0 ]] ; then
echo "No running proxies found, starting all";
$service_exec /services/$SERVICE_NAME.json stop;
$service_exec /services/$SERVICE_NAME.json start;
for proxies in $CONTAINERS ; do
@@ -105,13 +106,16 @@ elif [[ "$RUNNING_CONTAINERS" -eq 0 ]] ; then
echo "$proxies starting was unsuccesful"
fi
done
# In case of only one running proxy found, try to start the others of the service
elif [[ "$RUNNING_CONTAINERS" -eq 1 ]] ; then
echo "Only one running proxy found, starting all of the others";
for proxies in $CONTAINERS ; do
if [[ $proxies != $CONTAINER_NAMES ]] ; then
echo "No running containers: "$proxies" found.";
$service_exec $SERVICE_NAME.containers.$proxies start;
do_proxy_restart $proxies;
if docker ps | grep $proxies ; then
echo "$proxies started successful";
else