From 78176c9aa7afd52bd64413c7cdea1ae50abdf9d5 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Thu, 20 Oct 2022 00:17:42 +0200 Subject: [PATCH] Fix backup path setup in restic script --- .../yggdrasil/usr/local/sbin/restic-service-data | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/filesystem/yggdrasil/usr/local/sbin/restic-service-data b/playbooks/filesystem/yggdrasil/usr/local/sbin/restic-service-data index e7a1b84..e24d3c2 100644 --- a/playbooks/filesystem/yggdrasil/usr/local/sbin/restic-service-data +++ b/playbooks/filesystem/yggdrasil/usr/local/sbin/restic-service-data @@ -32,7 +32,9 @@ if __name__ == "__main__": } for service, info in snapshots_for_backup.items(): - backup_path = os.path.normpath(os.path.join("/", "mnt", os.path.relpath(info["dataset_path"], "/"))) + backup_path = os.path.normpath( + os.path.join("/", "mnt", os.path.relpath(info["dataset_path"], "/")) + ) snapshot = info["snapshot"] restic_cmd_base = "restic " \ f"--repo s3:https://{args.bucket_endpoint}/the-nine-worlds---{service} " \ @@ -45,9 +47,7 @@ if __name__ == "__main__": try: subprocess.run(f"{restic_cmd_base} snapshots || {restic_cmd_base} init", shell=True, check=True) - subprocess.run(f"cd {backup_path} && " - f"{restic_cmd_base} backup .", - shell=True, check=True) + subprocess.run(f"{restic_cmd_base} backup .", shell=True, cwd=backup_path, check=True) subprocess.run(f"{restic_cmd_base} forget --prune --keep-daily 90 --keep-monthly 12", shell=True, check=True) subprocess.run(f"{restic_cmd_base} check", shell=True, check=True)