From 7a638b8a6daadd924c0976630db42775ca168f0c Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Thu, 1 Aug 2024 09:47:54 +0200 Subject: [PATCH] daily-backup: fix issue with APACHE_PORT Signed-off-by: Simon L. --- Containers/mastercontainer/daily-backup.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Containers/mastercontainer/daily-backup.sh b/Containers/mastercontainer/daily-backup.sh index 62911b9c..56302c80 100644 --- a/Containers/mastercontainer/daily-backup.sh +++ b/Containers/mastercontainer/daily-backup.sh @@ -16,11 +16,15 @@ fi sudo -u www-data touch "/mnt/docker-aio-config/data/daily_backup_running" # Check if apache is running/stopped, watchtower is stopped and backupcontainer is stopped -APACHE_PORT="$(docker inspect nextcloud-aio-apache --format "{{.HostConfig.PortBindings}}" | grep -o '[0-9]\+' | head -1)" -while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-apache$" && ! nc -z nextcloud-aio-apache "$APACHE_PORT"; do - echo "Waiting for apache to become available" - sleep 30 -done +APACHE_PORT="$(docker inspect nextcloud-aio-apache --format "{{.Config.Env}}" | grep -o 'APACHE_PORT=[0-9]\+' | grep -o '[0-9]\+' | head -1)" +if [ -z "$APACHE_PORT" ]; then + echo "APACHE_PORT is not set which is not expected..." +else + while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-apache$" && ! nc -z nextcloud-aio-apache "$APACHE_PORT"; do + echo "Waiting for apache to become available" + sleep 30 + done +fi while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; do echo "Waiting for watchtower to stop" sleep 30