Browse Source

working on comparing checksums

master
Holger Frey 5 years ago
parent
commit
6269fafdda
  1. 6
      compare_checksums.py
  2. 2
      create_snapshot_backup.py

6
compare_checksums.py

@ -49,11 +49,11 @@ def get_remote_checksum(local_backup_path): @@ -49,11 +49,11 @@ def get_remote_checksum(local_backup_path):
return None
def get_local_checksum(local_backup_path):
result = call(["sha256", str(local_backup_path), as_text=True)
result = call(["sha256", str(local_backup_path)], as_text=True)
parts = result.split("=")
return parts[1].strip()
def batch_check()
def batch_check():
for local_backup_path in get_local_backups():
remote_checksum = get_remote_checksum(local_backup_path)
local_checksum = get_local_checksum(local_backup_path)
@ -61,7 +61,7 @@ def batch_check() @@ -61,7 +61,7 @@ def batch_check()
print("? {local_checksum} -> (error)")
elif remote_checksum == local_checksum:
print(" {local_checksum} -> {remote_checksum}")
else
else:
print("XXX {local_checksum} -> {remote_checksum}")

2
create_snapshot_backup.py

@ -46,7 +46,7 @@ def remote_call(arguments): @@ -46,7 +46,7 @@ def remote_call(arguments):
"""
cmd = ["ssh", "-i", SSH_KEY_FILE, SSH_REMOTE]
cmd.extend(arguments)
result = subprocess.run(cmd, as_text=True)
return call(cmd, as_text=True)
def clean_split(text):

Loading…
Cancel
Save