From d0f888cbb446b4ed990470b63027bd8b2819ec93 Mon Sep 17 00:00:00 2001 From: Fuxino Date: Thu, 8 Oct 2026 18:08:28 +0200 Subject: [PATCH] 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. --- man/simple_backup.1 | 2 +- simple_backup/simple_backup.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/man/simple_backup.1 b/man/simple_backup.1 index ff91233..2c216c7 100644 --- a/man/simple_backup.1 +++ b/man/simple_backup.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 diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index d9d4a39..2fcefbf 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -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}')