Make use of Repository.symlink_snapshot()
This commit is contained in:
parent
9372f158c2
commit
121bf416f1
14
bin/backup
14
bin/backup
@ -1,9 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
"""
|
||||
.. moduleauthor:: Eric Torres
|
||||
|
||||
Run a backup, creating a snapshot in the process.
|
||||
|
||||
Command-Line Arguments
|
||||
======================
|
||||
|
||||
* -c, --use-checksums use rsync's checksum feature to detect file changes
|
||||
* -d, --dry-run make this backup a dry run
|
||||
* --debug show debug messages
|
||||
@ -151,16 +154,7 @@ if __name__ == "__main__":
|
||||
syslog.critical(f"Failing command: {e.cmd}")
|
||||
exit(E_FAILED_PROCESS)
|
||||
|
||||
snapshot_symlink = repo.path / "current"
|
||||
|
||||
try:
|
||||
snapshot_symlink.unlink()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except PermissionError as e:
|
||||
syslog.error(e)
|
||||
|
||||
snapshot_symlink.symlink_to(curr_snapshot, target_is_directory=True)
|
||||
repo.symlink_snapshot(curr_snapshot)
|
||||
|
||||
if args.run_post_sync:
|
||||
syslog.info("Running sync operation")
|
||||
|
Loading…
x
Reference in New Issue
Block a user