mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-01 23:58:33 +02:00
lala
This commit is contained in:
@ -426,39 +426,42 @@ if _BACKUP:
|
|||||||
print("Sending finished status")
|
print("Sending finished status")
|
||||||
msg = {"mode":_MODE,"status":"finished","bak_name":"complete","start_time":STARTTIME,"end_time":ENDJOB,"progress":0,"used_space":used_space}
|
msg = {"mode":_MODE,"status":"finished","bak_name":"complete","start_time":STARTTIME,"end_time":ENDJOB,"progress":0,"used_space":used_space}
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
|
|
||||||
client.connect(broker,1883,10)
|
client.connect(broker,1883,10)
|
||||||
client.publish(topic_sum, json.dumps(msg))
|
client.publish(topic_sum, json.dumps(msg))
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
|
|
||||||
if _MODE == "auto":
|
os.remove(filename.path)
|
||||||
hostup = True
|
# if _MODE == "auto":
|
||||||
cmnd = "ssh root@omv.home.lan 'systemctl suspend &'"
|
# hostup = True
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
# cmnd = "ssh root@omv.home.lan 'systemctl suspend &'"
|
||||||
while hostup:
|
# status, output = subprocess.getstatusoutput(cmnd)
|
||||||
#HOST_UP = os.system(f"ping -c 1 -w 2 omv.home.lan") == 0
|
# while hostup:
|
||||||
cmnd = f"ping -c 1 -w 2 {BACKUP_HOST}"
|
# #HOST_UP = os.system(f"ping -c 1 -w 2 omv.home.lan") == 0
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
# cmnd = f"ping -c 1 -w 2 {BACKUP_HOST}"
|
||||||
# print(status)
|
# status, output = subprocess.getstatusoutput(cmnd)
|
||||||
# print(output)
|
# # print(status)
|
||||||
|
# # print(output)
|
||||||
|
|
||||||
|
|
||||||
if status == 0:
|
# if status == 0:
|
||||||
print(f"Backup host up, waiting - {n}\r", end="")
|
# print(f"Backup host up, waiting - {n}\r", end="")
|
||||||
time.sleep(5)
|
# time.sleep(5)
|
||||||
n += 1
|
# n += 1
|
||||||
else:
|
# else:
|
||||||
print("Backup host down " )
|
# print("Backup host down " )
|
||||||
hostup = False
|
# hostup = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
url = "http://m-server.home.lan:8123/api/webhook/-0eWYFhSTzdusAO8jwQS9t1AT?mode=off"
|
# url = "http://m-server.home.lan:8123/api/webhook/-0eWYFhSTzdusAO8jwQS9t1AT?mode=off"
|
||||||
|
|
||||||
x = requests.post(url)
|
# x = requests.post(url)
|
||||||
|
|
||||||
print(x.text)
|
# print(x.text)
|
||||||
except:
|
# except:
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user