mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-02 08:08:32 +02:00
lala
This commit is contained in:
@ -145,7 +145,7 @@ if _RESTORE:
|
|||||||
client.disconnect()
|
client.disconnect()
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||||
BACKUP_HOST = "root@omv.home.lan"
|
BACKUP_HOST = f"jd@{host}"
|
||||||
BACKUP_DEVICE = "/srv/dev-disk-by-uuid-2f843500-95b6-43b0-bea1-9b67032989b8"
|
BACKUP_DEVICE = "/srv/dev-disk-by-uuid-2f843500-95b6-43b0-bea1-9b67032989b8"
|
||||||
BACKUP_DIR = f"/backup/{host}"
|
BACKUP_DIR = f"/backup/{host}"
|
||||||
if app == "fail2ban":
|
if app == "fail2ban":
|
||||||
@ -313,7 +313,7 @@ if _BACKUP:
|
|||||||
if filename.is_file():
|
if filename.is_file():
|
||||||
print(filename.path)
|
print(filename.path)
|
||||||
print(filename.name)
|
print(filename.name)
|
||||||
continue
|
host = filename.name
|
||||||
print("Backup")
|
print("Backup")
|
||||||
for b in backups[host]:
|
for b in backups[host]:
|
||||||
topic = "sectorq/omv/backups/{}".format(b.lower())
|
topic = "sectorq/omv/backups/{}".format(b.lower())
|
||||||
@ -347,7 +347,7 @@ if _BACKUP:
|
|||||||
client.publish(topic, json.dumps(msg))
|
client.publish(topic, json.dumps(msg))
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
|
|
||||||
cmnd = "ssh root@omv.home.lan 'mkdir -p " + NEW_BACKUP_DIR + "'"
|
cmnd = "mkdir -p " + NEW_BACKUP_DIR
|
||||||
|
|
||||||
if _EXECUTE:
|
if _EXECUTE:
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
@ -359,11 +359,12 @@ if _BACKUP:
|
|||||||
if _FIRST:
|
if _FIRST:
|
||||||
cmnd = f"rsync -avz --delete {SOURCE_DIR} --exclude=\"gitlab/logs/prometheus\" --exclude=\"home-assistant.log\" --exclude=\"gitlab/logs/*\" --exclude=\"esphome/config/.esphome\" --exclude=\".cache\" --exclude=\".git\" --exclude=\"var_lib_motioneye\" rsync://{BACKUP_HOST}{BACKUP_PATH}"
|
cmnd = f"rsync -avz --delete {SOURCE_DIR} --exclude=\"gitlab/logs/prometheus\" --exclude=\"home-assistant.log\" --exclude=\"gitlab/logs/*\" --exclude=\"esphome/config/.esphome\" --exclude=\".cache\" --exclude=\".git\" --exclude=\"var_lib_motioneye\" rsync://{BACKUP_HOST}{BACKUP_PATH}"
|
||||||
else:
|
else:
|
||||||
cmnd = f"rsync -avz --delete {SOURCE_DIR} --link-dest {LATEST_LINK} --exclude=\"gitlab/logs/prometheus\" --exclude=\"home-assistant.log\" --exclude=\"gitlab/logs/*\" --exclude=\"esphome/config/.esphome\" --exclude=\".cache\" --exclude=\".git\" --exclude=\"var_lib_motioneye\" rsync://{BACKUP_HOST}{BACKUP_PATH}"
|
cmnd = f"rsync -avz --delete {BACKUP_HOST} --link-dest {LATEST_LINK} --exclude=\"gitlab/logs/prometheus\" --exclude=\"home-assistant.log\" --exclude=\"gitlab/logs/*\" --exclude=\"esphome/config/.esphome\" --exclude=\".cache\" --exclude=\".git\" --exclude=\"var_lib_motioneye\" {NEW_BACKUP_DIR}"
|
||||||
|
|
||||||
ans = "y"
|
ans = "y"
|
||||||
print(cmnd)
|
print(cmnd)
|
||||||
print("Sync files")
|
print("Sync files")
|
||||||
|
input("??????")
|
||||||
if _TEST:
|
if _TEST:
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user