Add manual selection of rsync options
This commit is contained in:
parent
4d23bde906
commit
970d3dde1e
@ -59,6 +59,25 @@ Default behavior is to remove old backups after successfully completing the back
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-no\-syslog
|
.B \-\-no\-syslog
|
||||||
Don't use systemd journal for logging
|
Don't use systemd journal for logging
|
||||||
|
.TP
|
||||||
|
.B \-\-rsync\-options OPTIONS [OPTION...]
|
||||||
|
By default, the following rsync options are used:
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
\-a \-r \-c \-v \-h \-H \-X
|
||||||
|
.PP
|
||||||
|
Using \-\-rsync\-options it is possible to manually select which options to use. Supported values are the following:
|
||||||
|
.PP
|
||||||
|
\-a, \-l, \-p, \-t, \-g, \-o, \-c, \-h, \-D, \-H, \-X
|
||||||
|
.PP
|
||||||
|
Options \-r and \-v are used in any case. Not that options must be specified without dash (\-), for example:
|
||||||
|
.PP
|
||||||
|
.EX
|
||||||
|
simple_backup \-\-rsync\-options a l p
|
||||||
|
.EE
|
||||||
|
.TP
|
||||||
|
Check rsync(1) for details about the options.
|
||||||
|
.RE
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
An example configuration file is provided at \(aq/etc/simple_backup/simple_backup.conf\(aq. Copy it to the default location
|
An example configuration file is provided at \(aq/etc/simple_backup/simple_backup.conf\(aq. Copy it to the default location
|
||||||
($HOME/.config/simple_backup) and edit it as needed.
|
($HOME/.config/simple_backup) and edit it as needed.
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"""Init."""
|
"""Init."""
|
||||||
|
|
||||||
__version__ = '3.4.1'
|
__version__ = '3.5.0'
|
||||||
|
@ -283,6 +283,9 @@ def _parse_arguments():
|
|||||||
parser.add_argument('--remove-before-backup', action='store_true',
|
parser.add_argument('--remove-before-backup', action='store_true',
|
||||||
help='Remove old backups before executing the backup, instead of after')
|
help='Remove old backups before executing the backup, instead of after')
|
||||||
parser.add_argument('--no-syslog', action='store_true', help='Disable systemd journal logging')
|
parser.add_argument('--no-syslog', action='store_true', help='Disable systemd journal logging')
|
||||||
|
parser.add_argument('--rsync-options', nargs='+',
|
||||||
|
choices=['a', 'l', 'p', 't', 'g', 'o', 'c', 'h', 'D', 'H', 'X'],
|
||||||
|
help='Specify options for rsync')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -369,12 +372,21 @@ def simple_backup():
|
|||||||
if args.keep is not None:
|
if args.keep is not None:
|
||||||
keep = args.keep
|
keep = args.keep
|
||||||
|
|
||||||
if args.checksum:
|
if args.rsync_options is None:
|
||||||
backup_options = '-arcvh -H -X'
|
if args.checksum:
|
||||||
|
rsync_options = '-arcvh -H -X'
|
||||||
|
else:
|
||||||
|
rsync_options = '-arvh -H -X'
|
||||||
else:
|
else:
|
||||||
backup_options = '-arvh -H -X'
|
rsync_options = '-r -v '
|
||||||
|
|
||||||
backup = Backup(inputs, output, exclude, keep, backup_options, remove_before=args.remove_before_backup)
|
for ro in args.rsync_options:
|
||||||
|
rsync_options = rsync_options + f'-{ro} '
|
||||||
|
|
||||||
|
if '-c ' not in rsync_options and args.checksum:
|
||||||
|
rsync_options = rsync_options + '-c'
|
||||||
|
|
||||||
|
backup = Backup(inputs, output, exclude, keep, rsync_options, remove_before=args.remove_before_backup)
|
||||||
|
|
||||||
return_code = backup.check_params()
|
return_code = backup.check_params()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user