mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-01 23:58:33 +02:00
Compare commits
17 Commits
24328d15e1
...
b6b2259a78
Author | SHA1 | Date | |
---|---|---|---|
b6b2259a78 | |||
f2ae0b14bd | |||
535297a8f7 | |||
81e08f7893 | |||
3232bf9220 | |||
36017a6e9a | |||
47babb6080 | |||
85cf2122b1 | |||
1c3468f742 | |||
22fdeab1d2 | |||
f304b908be | |||
f45d719e17 | |||
17e5029080 | |||
06480eb226 | |||
1d6448813d | |||
da38d219c1 | |||
9276a3f776 |
@ -13,6 +13,7 @@ import re
|
|||||||
import platform
|
import platform
|
||||||
import requests
|
import requests
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import yaml
|
||||||
from wakeonlan import send_magic_packet
|
from wakeonlan import send_magic_packet
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
|
|
||||||
@ -302,6 +303,50 @@ if _RESTORE:
|
|||||||
ans = input("continue?") or "n"
|
ans = input("continue?") or "n"
|
||||||
if ans == "y" and _EXECUTE:
|
if ans == "y" and _EXECUTE:
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
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)
|
||||||
|
|
||||||
|
if _TEST:
|
||||||
|
ans = input("continue?") or "n"
|
||||||
|
if ans == "y" and _EXECUTE:
|
||||||
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
|
||||||
|
file = "/share/docker_data/homepage/config/widgets.yaml"
|
||||||
|
with open(file, 'r') as stream:
|
||||||
|
try:
|
||||||
|
loaded = yaml.load(stream, Loader=yaml.FullLoader)
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
print(exc)
|
||||||
|
|
||||||
|
# Modify the fields from the dict
|
||||||
|
#loaded['logo']['icon'] = "/images/morefine2.png"
|
||||||
|
print(json.dumps(loaded, indent=2))
|
||||||
|
i = 0
|
||||||
|
for y in loaded:
|
||||||
|
print(i)
|
||||||
|
print(y)
|
||||||
|
|
||||||
|
if "logo" in y:
|
||||||
|
loaded[i]['logo']['icon'] = "/images/qnap_nas.png"
|
||||||
|
i+=1
|
||||||
|
|
||||||
|
# Save it again
|
||||||
|
print(f"writing to file {file}")
|
||||||
|
with open(file, 'w') as stream:
|
||||||
|
try:
|
||||||
|
yaml.dump(loaded, stream, default_flow_style=False)
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
print("failed")
|
||||||
|
print(exc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("Start docker")
|
print("Start docker")
|
||||||
# cmnd = "docker start heimdall"
|
# cmnd = "docker start heimdall"
|
||||||
# status, output = subprocess.getstatusoutput(cmnd)
|
# status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
@ -3,4 +3,5 @@ requests
|
|||||||
getmac
|
getmac
|
||||||
paho-mqtt
|
paho-mqtt
|
||||||
autorandr
|
autorandr
|
||||||
wakeonlan
|
wakeonlan
|
||||||
|
pyyaml
|
Reference in New Issue
Block a user