I am attempting to rsnapshot from different server environments, which requires different rsync arguments. The fix for my problem appears to be to use per-backup-point parameters.

from the manual (rsnapshot)

backup /var/ localhost/ one_fs=1

This is the same as the other examples, but notice the fourth column. This is how you specify per-backup-point options to over-ride global settings. This extra parameter can take several options, separated by commas.

It is most useful when specifying per-backup rsync excludes thus:

backup root@somehost:/ somehost +rsync_long_args=--exclude=/var/spool/??

Note the + sign. That tells rsnapshot to add to the list of arguments to pass to rsync instead of replacing the list.

This issue is that the paramater I want to add has a comma in it. No amount of messing with quotes seems to have an effect.

here's what I want to add

+rsync_long_args=--chmod D0770,F0660

Here's the output (from one of my trials with single quotes)

/usr/local/bin/rsnapshot configtest 
ERROR: /usr/local/etc/rsnapshot.conf on line 202:
ERROR: backup backupadmin@prime::shared_folders/ prime/shared_folders \
         +rsync_long_args='--chmod D0770,F0660' - Syntax error on \
         line 202 in extra opts: +rsync_long_args='--chmod \
ERROR: ---------------------------------------------------------------------

Any guidance appreciated.

It is actually a little more complicated, as I need to change both the short_args and the long_args, but I think the comma is the show-stopper. I have tried replacing the entire parameter string, too, with the same result. I have also tried "escaping" the comma with a backslash, all with and without single and double quotes.


1 Answer 1


You cannot use comma in a parameter provided through the extra options: the code doesn't allow it.

The rsnapshot code itself:

sub parse_backup_opts {
    # split on commas first
    @pairs = split(/,/, $opts_str);

My recommendation in this instance would be to use different rsnapshot.conf files per source system. You can pull out the common parts so that each *.conf file consists of as few lines as possible:

include_conf            /usr/local/rsnapshot/DEFAULT.inc

lockfile                /var/run/rsnapshot-remoteserver.pid

rsync_short_args        -avzSi
rsync_long_args         --delete --delete-excluded --numeric-ids --fake-super ...

snapshot_root           /backup/rsnapshot/remoteserver
one_fs                  1

backup                  remoteuser@remoteserver:/         root/
backup                  remoteuser@remoteserver:/home/    home/

exclude_file            /usr/local/rsnapshot/EXCLUDE-linux.inc

Put the common configuration into DEFAULT.inc, and common exclusions into files such as EXCLUDE-linux.inc. You can then use this rsnapshot configuration file with the -c flag

rsnapshot -c /usr/local/rsnapshot/remoteserver.conf hourly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.