27 lines
982 B
Python
Executable File
27 lines
982 B
Python
Executable File
#!/bin/python3
|
|
import argparse
|
|
from functions import *
|
|
|
|
default_backup_dir()
|
|
|
|
parser = argparse.ArgumentParser(description="Backup script")
|
|
parser.add_argument("-s", "--show", action="store_true", help="Show enabled paths")
|
|
parser.add_argument("-d", "--debug", action="store_true", help="Enable debug")
|
|
parser.add_argument("-c", "--check", action="store_true", help="Check the declared path info")
|
|
parser.add_argument("-r", "--rotate", action="store_true", help="Rotate the backups")
|
|
parser.add_argument("--dry", action="store_true", help="Dry run for rotate: show what would be deleted (no deletion)")
|
|
args = parser.parse_args()
|
|
|
|
if args.show:
|
|
show_enabled()
|
|
elif args.debug:
|
|
backups_now(debug="on")
|
|
elif args.check:
|
|
checked = check_existing_folders(debug="on")
|
|
#print(checked)
|
|
elif args.rotate:
|
|
# passa il flag dry al chiamante; default è delete se non specifichi --dry
|
|
autorotate_backups(dry_run=args.dry)
|
|
else:
|
|
backups_now()
|
|
autorotate_backups() |