mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 02:34:53 +01:00
bitwarden
This commit is contained in:
@@ -36,7 +36,7 @@ mqtt_username = 'jaydee'
|
||||
mqtt_password = 'jaydee1'
|
||||
|
||||
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:
|
||||
#usage()
|
||||
sys.exit(2)
|
||||
@@ -56,6 +56,7 @@ for o, a in opts:
|
||||
_TEST = True
|
||||
elif o in ("-r", "--restore"):
|
||||
_RESTORE = True
|
||||
_APP = a
|
||||
elif o in ("-b", "--backup"):
|
||||
_BACKUP = True
|
||||
elif o in ("-d", "--dry"):
|
||||
@@ -142,22 +143,18 @@ print(f"Port {port} on {BACKUP_HOST} is open.")
|
||||
if _RESTORE:
|
||||
for b in backups[host]:
|
||||
topic = "sectorq/omv/backups/{}".format(b.lower())
|
||||
if not backups[host][b]["active"]:
|
||||
print("Backup {} is not active!".format(b))
|
||||
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.disconnect()
|
||||
continue
|
||||
|
||||
SOURCE_DIR = backups[host][b]["source"]
|
||||
now = datetime.datetime.now()
|
||||
BACKUP_HOST = "root@omv.home.lan"
|
||||
BACKUP_DEVICE = "/srv/dev-disk-by-uuid-2f843500-95b6-43b0-bea1-9b67032989b8"
|
||||
BACKUP_DIR = f"/backup/{host}/{b}"
|
||||
NEW_BACKUP_DIR = f"{BACKUP_DEVICE}/backup/{host}/{b}"
|
||||
DATETIME = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
SOURCE_DIR = f"{BACKUP_DIR}/{_APP}"
|
||||
if _FIRST:
|
||||
BACKUP_PATH="{}/initial".format(BACKUP_DIR)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user