From 15f77b6bf518481d788e7ad20e987a6adc6ebaf0 Mon Sep 17 00:00:00 2001 From: Hartmut Bauer Date: Tue, 29 Apr 2025 22:56:18 +0200 Subject: [PATCH] 1st step to podman --- hamiller.sh | 4 ++-- main.inc.sh | 30 +++++++++++++++++++++--------- main.sh | 3 ++- nathan.sh | 4 ++-- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/hamiller.sh b/hamiller.sh index 9905613..b42a3c9 100755 --- a/hamiller.sh +++ b/hamiller.sh @@ -14,12 +14,12 @@ backup_daily2() { before_backup() { - stop_docker + stop_containers return $? } after_backup() { - start_docker + start_containers local dock=$? copy_to_nas "$BACKUP_TARGET" "$NAS_TARGET" local copy=$? diff --git a/main.inc.sh b/main.inc.sh index aec985b..a4642ec 100755 --- a/main.inc.sh +++ b/main.inc.sh @@ -140,18 +140,30 @@ check_root() { fi } -start_docker() { - log $DEBUG "$DBG start_docker()" - log $DEBUG "$DBG > \$DOCKER up -d" - $DOCKER up -d >>$LOG_FILE 2>&1 - return $? +start_containers() { + log $DEBUG "$DBG start_containers()" + if [ -f /var/docker/run/docker-compose.yml ]; then + log $DEBUG "$DBG > \$DOCKER up -d" + $DOCKER up -d >>$LOG_FILE 2>&1 + return $? + else + log $DEBUG "$DBG > sudo systemctl start pihole" + sudo systemctl start pihole >>$LOG_FILE 2>&1 + return $? + fi } -stop_docker() { +stop_containers() { log $DEBUG "$DBG stop_docker()" - log $DEBUG "$DBG > \$DOCKER down" - $DOCKER down >>$LOG_FILE 2>&1 - return $? + if [ -f /var/docker/run/docker-compose.yml ]; then + log $DEBUG "$DBG > \$DOCKER down" + $DOCKER down >>$LOG_FILE 2>&1 + return $? + else + log $DEBUG "$DBG > sudo systemctl stop pihole" + sudo systemctl stop pihole >>$LOG_FILE 2>&1 + return $? + fi } # Zugriffsrechte für Logs und Backups setzen diff --git a/main.sh b/main.sh index 8ec030f..b168ff6 100755 --- a/main.sh +++ b/main.sh @@ -3,9 +3,10 @@ # entrypoint for all actions # +# 2.1.7 29.04.2025 - 1. Schritt zur Umstellung auf podman # 2.1.6 29.04.2025 - weekly backup Sa->SO -VER="2.1.6" +VER="2.1.7" HERE=$(dirname "$0") THIS_SCRIPT=$0 diff --git a/nathan.sh b/nathan.sh index 67eb125..65776f3 100755 --- a/nathan.sh +++ b/nathan.sh @@ -28,12 +28,12 @@ before_backup() { if [ $mys -gt 0 ] || [ $pos -gt 0 ]; then return 1 fi - stop_docker + stop_containers return $? } after_backup() { - start_docker + start_containers local dock=$? copy_to_nas "$BACKUP_TARGET" "$NAS_TARGET" local copy=$?