diff --git a/repo_sync.py b/repo_sync.py index 96df829..55c9609 100644 --- a/repo_sync.py +++ b/repo_sync.py @@ -65,7 +65,7 @@ def restore() -> bool: # "/./" marks where the relative path starts, so with -R each subtree # lands under $HOME with its original relative path cmd = ["rsync", "-aR", *exclude_args(), "-e", SSH_OPTS, - *[f"{CENTRAL}:{REMOTE_DIR}/restore/./{d}" for d in get_dirs()], f"{HOME}/"] + *[f"{CENTRAL}:{REMOTE_DIR}/restore-running/./{d}" for d in get_dirs()], f"{HOME}/"] return subprocess.run(cmd).returncode == 0 @@ -77,13 +77,13 @@ def cmd_restore(): except Exception as e: log(repr(e)) time.sleep(1) - dorestore = f"{REMOTE_DIR}/do.restore" - if ssh(f"ls {dorestore}") is None: + if ssh(f"ls {REMOTE_DIR}/restore") is None: log("no restore needed") else: + ssh(f"mv {REMOTE_DIR}/restore {REMOTE_DIR}/restore-running") if restore(): log("restore done") - ssh(f"rm {dorestore}") + ssh(f"mv {REMOTE_DIR}/restore-running {REMOTE_DIR}/restore-done") return True else: log("restore failed")