mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 10:44:52 +01:00
bitwarden
This commit is contained in:
@@ -36,7 +36,7 @@ mqtt_username = 'jaydee'
|
|||||||
mqtt_password = 'jaydee1'
|
mqtt_password = 'jaydee1'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "amftdr", ["command=", "help", "output="])
|
opts, args = getopt.getopt(sys.argv[1:], "amftdr:", ["command=", "help", "output="])
|
||||||
except getopt.GetoptError as err:
|
except getopt.GetoptError as err:
|
||||||
#usage()
|
#usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@@ -56,6 +56,7 @@ for o, a in opts:
|
|||||||
_TEST = True
|
_TEST = True
|
||||||
elif o in ("-r", "--restore"):
|
elif o in ("-r", "--restore"):
|
||||||
_RESTORE = True
|
_RESTORE = True
|
||||||
|
_APP = a
|
||||||
elif o in ("-b", "--backup"):
|
elif o in ("-b", "--backup"):
|
||||||
_BACKUP = True
|
_BACKUP = True
|
||||||
elif o in ("-d", "--dry"):
|
elif o in ("-d", "--dry"):
|
||||||
@@ -142,22 +143,18 @@ print(f"Port {port} on {BACKUP_HOST} is open.")
|
|||||||
if _RESTORE:
|
if _RESTORE:
|
||||||
for b in backups[host]:
|
for b in backups[host]:
|
||||||
topic = "sectorq/omv/backups/{}".format(b.lower())
|
topic = "sectorq/omv/backups/{}".format(b.lower())
|
||||||
if not backups[host][b]["active"]:
|
client.connect(broker,1883,60)
|
||||||
print("Backup {} is not active!".format(b))
|
msg = {"status":"inactive","bak_name":b,"start_time":"inactive","end_time":"inactive","progress":0}
|
||||||
client.connect(broker,1883,60)
|
|
||||||
msg = {"status":"inactive","bak_name":b,"start_time":"inactive","end_time":"inactive","progress":0}
|
|
||||||
|
|
||||||
client.publish(topic, json.dumps(msg))
|
client.publish(topic, json.dumps(msg))
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
continue
|
|
||||||
|
|
||||||
SOURCE_DIR = backups[host][b]["source"]
|
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
BACKUP_HOST = "root@omv.home.lan"
|
BACKUP_HOST = "root@omv.home.lan"
|
||||||
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}/{b}"
|
BACKUP_DIR = f"/backup/{host}/{b}"
|
||||||
NEW_BACKUP_DIR = f"{BACKUP_DEVICE}/backup/{host}/{b}"
|
NEW_BACKUP_DIR = f"{BACKUP_DEVICE}/backup/{host}/{b}"
|
||||||
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||||
|
SOURCE_DIR = f"{BACKUP_DIR}/{_APP}"
|
||||||
if _FIRST:
|
if _FIRST:
|
||||||
BACKUP_PATH="{}/initial".format(BACKUP_DIR)
|
BACKUP_PATH="{}/initial".format(BACKUP_DIR)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user