mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-03 00:23:06 +02:00
initial
This commit is contained in:
@ -166,9 +166,15 @@ print(f"Port {port} on {BACKUP_HOST} is open.")
|
||||
print("Starting")
|
||||
|
||||
if _RESTORE:
|
||||
topic = "sectorq/omv/restore/{}".format(_APP)
|
||||
if _APP == "all":
|
||||
_APP = ["nginx","ha","gitlab","mailu"]
|
||||
else:
|
||||
_APP = _APP.split(",")
|
||||
|
||||
for app in _APP:
|
||||
topic = "sectorq/omv/restore/{}".format(app)
|
||||
client.connect(broker,1883,60)
|
||||
msg = {"status":"inactive","bak_name":_APP,"start_time":"inactive","end_time":"inactive","progress":0}
|
||||
msg = {"status":"inactive","bak_name":app,"start_time":"inactive","end_time":"inactive","progress":0}
|
||||
|
||||
client.publish(topic, json.dumps(msg))
|
||||
client.disconnect()
|
||||
@ -176,7 +182,7 @@ if _RESTORE:
|
||||
BACKUP_HOST = "root@omv.home.lan"
|
||||
BACKUP_DEVICE = "/srv/dev-disk-by-uuid-2f843500-95b6-43b0-bea1-9b67032989b8"
|
||||
BACKUP_DIR = f"/backup/{host}"
|
||||
NEW_BACKUP_DIR = f"/backup/m-server/docker_data/latest/{_APP}"
|
||||
NEW_BACKUP_DIR = f"/backup/m-server/docker_data/latest/{app}"
|
||||
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
SOURCE_DIR = f"/share/docker_data/"
|
||||
if _FIRST:
|
||||
@ -185,10 +191,10 @@ if _RESTORE:
|
||||
BACKUP_PATH="{}/{}".format(BACKUP_DIR, DATETIME)
|
||||
LATEST_LINK="{}/latest".format(BACKUP_DIR)
|
||||
FULL_BACKUP_LATEST = f"{NEW_BACKUP_DIR}/latest"
|
||||
LATEST_LINK = f"/{host}/{_APP}/latest"
|
||||
LATEST_LINK = f"/{host}/{app}/latest"
|
||||
|
||||
|
||||
msg = {"status":"started","bak_name":_APP,"start_time":DATETIME,"end_time":"in progress", "progress":0}
|
||||
msg = {"status":"started","bak_name":app,"start_time":DATETIME,"end_time":"in progress", "progress":0}
|
||||
client.connect(broker,1883,60)
|
||||
client.publish(topic, json.dumps(msg))
|
||||
client.disconnect()
|
||||
@ -241,7 +247,7 @@ if _RESTORE:
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
now = datetime.datetime.now()
|
||||
ENDTIME = now.strftime("%Y-%m-%d_%H:%M:%S")
|
||||
msg = {"status":"finished","bak_name":_APP,"start_time":DATETIME,"end_time":ENDTIME,"progress":0}
|
||||
msg = {"status":"finished","bak_name":app,"start_time":DATETIME,"end_time":ENDTIME,"progress":0}
|
||||
client.connect(broker,1883,10)
|
||||
client.publish(topic, json.dumps(msg))
|
||||
client.disconnect()
|
||||
|
Reference in New Issue
Block a user