Add provisions for resolving a remote host
This commit is contained in:
parent
841e05c3de
commit
42c0bf0597
15
bin/backup
15
bin/backup
@ -12,6 +12,7 @@ Command-Line Arguments
|
|||||||
--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
|
-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
|
||||||
-v, --verbose show info messages
|
-v, --verbose show info messages
|
||||||
@ -93,6 +94,12 @@ def parse_cmdline_arguments(**kwargs):
|
|||||||
default=22,
|
default=22,
|
||||||
help="port that ssh on the destination is listening on",
|
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",
|
||||||
@ -118,9 +125,15 @@ def parse_cmdline_arguments(**kwargs):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = parse_cmdline_arguments()
|
args = parse_cmdline_arguments()
|
||||||
|
|
||||||
|
dest = (
|
||||||
|
args.repository
|
||||||
|
if args.remote_host is None
|
||||||
|
else f"{args.remote_host}@{os.getlogin()}:{args.port}{args.repository}"
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parsed_config = config.parse_configfile()
|
parsed_config = config.parse_configfile()
|
||||||
repo = Repository(args.repository)
|
repo = Repository(dest)
|
||||||
except PermissionError as e:
|
except PermissionError as e:
|
||||||
syslog.critical(e)
|
syslog.critical(e)
|
||||||
exit(E_PERMISSION)
|
exit(E_PERMISSION)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user