Backup script maintenance
This commit is contained in:
parent
2a943ad32c
commit
7e696df9c2
12
bin/backup
12
bin/backup
@ -75,9 +75,9 @@ syslog.addHandler(stderr_handler)
|
|||||||
|
|
||||||
|
|
||||||
# ========== Functions ==========
|
# ========== Functions ==========
|
||||||
def parse_cmdline_arguments(*args, **kwargs):
|
def parse_cmdline_arguments(**kwargs):
|
||||||
"""Parse command line arguments passed to the script.
|
"""Parse command line arguments passed to the script.
|
||||||
All args and kwargs are passed to ArgumentParser.parse_args()
|
All kwargs are passed to ArgumentParser.parse_args().
|
||||||
|
|
||||||
:rtype: argparse.Namespace object
|
:rtype: argparse.Namespace object
|
||||||
"""
|
"""
|
||||||
@ -113,7 +113,7 @@ def parse_cmdline_arguments(*args, **kwargs):
|
|||||||
)
|
)
|
||||||
parser.add_argument("repository", help="repository to back up to", metavar="repo")
|
parser.add_argument("repository", help="repository to back up to", metavar="repo")
|
||||||
|
|
||||||
return parser.parse_args(*args, **kwargs)
|
return parser.parse_args(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
# ========== Main Script ==========
|
# ========== Main Script ==========
|
||||||
@ -153,10 +153,12 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
snapshot_symlink.unlink()
|
snapshot_symlink.unlink()
|
||||||
|
snapshot_symlink.symlink_to(curr_snapshot, target_is_directory=True)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
except PermissionError as e:
|
||||||
snapshot_symlink.symlink_to(curr_snapshot, target_is_directory=True)
|
syslog.error(e)
|
||||||
|
|
||||||
if args.run_post_sync:
|
if args.run_post_sync:
|
||||||
|
syslog.info("Running sync operation")
|
||||||
os.sync()
|
os.sync()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user