Make backup script strictly for backups to a local repository

This commit is contained in:
Eric Torres 2019-04-28 22:17:03 -07:00
parent 485b3adf30
commit 3821b723d9

View File

@ -9,22 +9,13 @@ Command-Line Arguments
-d, --dry-run make this backup a dry run -d, --dry-run make this backup a dry run
--debug show debug messages --debug show debug messages
-n, --name name to give to the backup snapshot -n, --name name to give to the backup snapshot
-p, --port port that ssh on the destination is listening on
-r, --remote-host address/alias of remote machine to use
-s, --run-post-sync run sync syscall after backup -s, --run-post-sync run sync syscall after backup
-u, --umask umask value to use while running backup process -u, --umask umask value to use while running backup process
Run a backup, creating a snapshot in the process. Run a local backup, creating a snapshot in the process.
On each run of this script, a new snapshot is made and any unchanged On each run of this script, a new snapshot is made and any unchanged
files are hardlinked into the new snapshot. files are hardlinked into the new snapshot.
A remote host can be specified by passing the -r option, and its port can be
specified by passing the -p option.
TODO serialize relevant data in an object i.e. args and config, send that over the network encrypted
to prepare the repository
and
""" """
import argparse import argparse
import logging import logging
@ -80,18 +71,6 @@ def parse_cmdline_arguments(**kwargs):
parser.add_argument( parser.add_argument(
"-n", "--name", default=None, help="name to give to the snapshot" "-n", "--name", default=None, help="name to give to the snapshot"
) )
parser.add_argument(
"-p",
"--port",
default=22,
help="port that ssh on the destination is listening on",
)
parser.add_argument(
"-r",
"--remote-host",
default=None,
help="address/alias of remote machine to use",
)
parser.add_argument( parser.add_argument(
"-s", "-s",
"--run-post-sync", "--run-post-sync",
@ -123,11 +102,7 @@ if __name__ == "__main__":
syslog.addHandler(stdout_handler) syslog.addHandler(stdout_handler)
syslog.addHandler(stderr_handler) syslog.addHandler(stderr_handler)
dest = ( dest = args.repository
args.repository
if args.remote_host is None
else f"{args.remote_host}@{os.getlogin()}:{args.port}/{args.repository}"
)
syslog.debug(f"Repository destination: {dest}") syslog.debug(f"Repository destination: {dest}")