This commit is contained in:
2025-01-10 22:15:57 +01:00
parent 972005c82a
commit 301e14a404

View File

@ -426,39 +426,42 @@ if _BACKUP:
print("Sending finished status")
msg = {"mode":_MODE,"status":"finished","bak_name":"complete","start_time":STARTTIME,"end_time":ENDJOB,"progress":0,"used_space":used_space}
print(msg)
client.connect(broker,1883,10)
client.publish(topic_sum, json.dumps(msg))
client.disconnect()
if _MODE == "auto":
hostup = True
cmnd = "ssh root@omv.home.lan 'systemctl suspend &'"
status, output = subprocess.getstatusoutput(cmnd)
while hostup:
#HOST_UP = os.system(f"ping -c 1 -w 2 omv.home.lan") == 0
cmnd = f"ping -c 1 -w 2 {BACKUP_HOST}"
status, output = subprocess.getstatusoutput(cmnd)
# print(status)
# print(output)
os.remove(filename.path)
# if _MODE == "auto":
# hostup = True
# cmnd = "ssh root@omv.home.lan 'systemctl suspend &'"
# status, output = subprocess.getstatusoutput(cmnd)
# while hostup:
# #HOST_UP = os.system(f"ping -c 1 -w 2 omv.home.lan") == 0
# cmnd = f"ping -c 1 -w 2 {BACKUP_HOST}"
# status, output = subprocess.getstatusoutput(cmnd)
# # print(status)
# # print(output)
if status == 0:
print(f"Backup host up, waiting - {n}\r", end="")
time.sleep(5)
n += 1
else:
print("Backup host down " )
hostup = False
# if status == 0:
# print(f"Backup host up, waiting - {n}\r", end="")
# time.sleep(5)
# n += 1
# else:
# print("Backup host down " )
# hostup = False
try:
url = "http://m-server.home.lan:8123/api/webhook/-0eWYFhSTzdusAO8jwQS9t1AT?mode=off"
# try:
# url = "http://m-server.home.lan:8123/api/webhook/-0eWYFhSTzdusAO8jwQS9t1AT?mode=off"
x = requests.post(url)
# x = requests.post(url)
print(x.text)
except:
pass
# print(x.text)
# except:
# pass