This commit is contained in:
2025-03-03 14:58:58 +01:00
parent 24328d15e1
commit 9276a3f776

View File

@ -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: