Browse Source

working on a working version

master
Holger Frey 5 years ago
parent
commit
960685e736
  1. 27
      zfs-snapshot-backup.py

27
zfs-snapshot-backup.py

@ -96,24 +96,24 @@ def backup_latest_snapshot(member, elab_snapshots, existing_backups): @@ -96,24 +96,24 @@ def backup_latest_snapshot(member, elab_snapshots, existing_backups):
# create the backup
print(" - generating temporary backup file")
tmp_gzip_filepath = gzip_filepath(current_snapshot)
with open(tmp_gzip_filepath, "wb") as file_handle:
gzip_in = subprocess.Popen(
"gzip", stdin=subprocess.PIPE, stdout=file_handle, check=True
).stdin
subprocess.call(send_cmd, stdout=gzip_in, check=True)
#tmp_gzip_filepath = gzip_filepath(current_snapshot)
#with open(tmp_gzip_filepath, "wb") as file_handle:
# gzip_in = subprocess.Popen(
# "gzip", stdin=subprocess.PIPE, stdout=file_handle, check=True
# ).stdin
# subprocess.call(send_cmd, stdout=gzip_in, check=True)
# copy the backup to the remote server
print(" - copying temporary backup file")
remote_url = (
f"{SSH_REMOTE}:~/{REMOTE_PATH}/{member}/{tmp_gzip_filepath.name}"
)
copy_cmd = ["scp", "-i", SSH_KEY_FILE, str(tmp_gzip_filepath), remote_url]
call(copy_cmd)
#remote_url = (
# f"{SSH_REMOTE}:~/{REMOTE_PATH}/{member}/{tmp_gzip_filepath.name}"
#)
#copy_cmd = ["scp", "-i", SSH_KEY_FILE, str(tmp_gzip_filepath), remote_url]
#call(copy_cmd)
# remove the temporary file
print(" - removing temporary backup file")
tmp_gzip_filepath.unlink()
#tmp_gzip_filepath.unlink()
def create_backups():
@ -125,5 +125,4 @@ def create_backups(): @@ -125,5 +125,4 @@ def create_backups():
if __name__ == "__main__":
es = elab_snapshots()
print(list_remote_backups(es.keys()))
create_backups()

Loading…
Cancel
Save