Always use --mkpath and --ignore-missing-args with rsync
With --rsync-options, only -r and -v were kept, so the first backup failed because the simple_backup directory did not exist yet, and a missing input made rsync fail. Use these options in any case.
This commit is contained in:
+1
-1
@@ -112,7 +112,7 @@ Using \-\-rsync\-options it is possible to manually select which options to use.
|
||||
.P
|
||||
\-a, \-l, \-p, \-t, \-g, \-o, \-c, \-h, \-D, \-H, \-X, \-s
|
||||
.P
|
||||
Options \-r and \-v are used in any case. Not that options must be specified without dash (\-), for example:
|
||||
Options \-r, \-v, \-\-ignore\-missing\-args and \-\-mkpath are used in any case. Note that options must be specified without dash (\-), for example:
|
||||
.P
|
||||
.EX
|
||||
simple_backup \-\-rsync\-options a l p
|
||||
|
||||
@@ -937,12 +937,12 @@ def simple_backup() -> int:
|
||||
ssh_keyfile = args.keyfile if args.keyfile is not None else config_args['ssh_keyfile']
|
||||
remote_sudo = args.remote_sudo or config_args['remote_sudo']
|
||||
|
||||
if args.rsync_options is None:
|
||||
rsync_options = ['-a', '-r', '-v', '-h', '-H',
|
||||
'-X', '-s', '--ignore-missing-args', '--mkpath']
|
||||
else:
|
||||
rsync_options = ['-r', '-v']
|
||||
# Options needed in any case (--mkpath creates the backup directory on the first run)
|
||||
rsync_options = ['-r', '-v', '--ignore-missing-args', '--mkpath']
|
||||
|
||||
if args.rsync_options is None:
|
||||
rsync_options.extend(['-a', '-h', '-H', '-X', '-s'])
|
||||
else:
|
||||
for ro in args.rsync_options:
|
||||
rsync_options.append(f'-{ro}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user