From 9276a3f77690d953c7e63387f57835ad2d8fb00f Mon Sep 17 00:00:00 2001 From: jaydee Date: Mon, 3 Mar 2025 14:58:58 +0100 Subject: [PATCH] lala --- omv_backup_v3.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/omv_backup_v3.py b/omv_backup_v3.py index 494b000..4b704d1 100644 --- a/omv_backup_v3.py +++ b/omv_backup_v3.py @@ -13,6 +13,7 @@ import re import platform import requests import fnmatch +import yaml from wakeonlan import send_magic_packet pid = os.getpid() @@ -298,6 +299,36 @@ if _RESTORE: ans = "y" print(cmnd) print("Sync files") + if _TEST: + ans = input("continue?") or "n" + if ans == "y" and _EXECUTE: + status, output = subprocess.getstatusoutput(cmnd) + print("Start docker") + # cmnd = "docker start heimdall" + # status, output = subprocess.getstatusoutput(cmnd) + elif app == "homepage": + print("Stopping docker") + cmnd = f"rsync -avz --delete {BACKUP_HOST}:{BACKUP_DEVICE}{NEW_BACKUP_DIR} {SOURCE_DIR}" + ans = "y" + print(cmnd) + file = "/share/docker_data/homepage/config/widgets.yaml" + with open(file, 'r') as stream: + try: + loaded = yaml.load(stream) + except yaml.YAMLError as exc: + print(exc) + + # Modify the fields from the dict + #loaded['logo']['icon'] = "/images/morefine2.png" + loaded['logo']['icon'] = "/images/qnap_nas.png" + + # Save it again + with open(file, 'w') as stream: + try: + yaml.dump(loaded, stream, default_flow_style=False) + except yaml.YAMLError as exc: + print(exc) + if _TEST: ans = input("continue?") or "n" if ans == "y" and _EXECUTE: