1

I've severals VPS with Ubuntu 18.04 LTS.
One of these VPS is the backup master and launches rsnapshot to backup its own folders and pull the remote folders on the other VPSs.

These are the commands in the file rsnapshot.conf:

#server1 (backup server)
backup  /etc/   server1/
backup  /home/  server1/
backup  /opt/   server1/
backup  /root/  server1/
backup  /srv/   server1/
backup  /usr/local/ server1/
backup  /var/   server1/  
exclude /var/cache/
exclude /var/lock/
exclude /var/log/
exclude /var/run/
exclude /var/spool/
exclude /var/tmp/
exclude logs/

 #server2 (remote server)
backup  server2:/etc/   server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh  
backup  server2:/home/  server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh  
backup  server2:/opt/   server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh  
backup  server2:/srv/   server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh  
backup  server2:/usr/local/ server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh  
backup  server2:/var/   server2/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh,--exclude=/var/cache/,--exclude=/var/lock/,--exclude=/var/log/,--exclude=/var/spool/,--exclude=/var/tmp/

With rsnapshot configtest, the last row is reported as a configuration error.
My goal is to save the same folders as the main server and to exclude some of them under /var.

I have consulted the man and several pages online, but I cannot understand what the right syntax is for excluding multiple folders in a single backup row.

Thanks in advance for the help.


=== Update ===

I've changed the last command with:

backup  server1:/var/   server1/    +rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh,exclude_file=/etc/rsnapshot.exclude

The file rsnapshot.exclude contains:

/var/cache/  
/var/lock/  
/var/log/  
/var/run/  
/var/spool/  
/var/tmp/  
logs/  

Now the command is executed without errors, but for the server1 it has copied the whole /var directory, including the folders to be excluded. Instead nothing in /var for the others servers.

2
  • "All parameters in this file must be separated by tabs". Do you have maybe a space instead? Also I suggest you use exclude_file instead of multiple excludes. Jul 6, 2019 at 19:07
  • Please, see my update Jul 7, 2019 at 5:43

2 Answers 2

1

You have to separate the arguments to rsync with spaces, not commas. I.e., instead of this:

+rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh,exclude_file=/etc/rsnapshot.exclude

You should use:

+rsync_long_args=--rsync-path=/usr/local/bin/rsync_wrapper.sh exclude_file=/etc/rsnapshot.exclude

rsnapshot will pass the arguments verbatim to rsync. If you use commas, it will believe everything (--rsync-path=/usr/local/bin/rsync_wrapper.sh,exclude_file=/etc/rsnapshot.exclude) is a single one, and won't work. There should be errors in the log file for rsnapshot.

That was my experience, at least. I tried to add one more option to rsync_long_args and found rsnapshot ignored me. When I changed the comma for a space it started working. Please, try this and see if it works for you too.

1
  • There are some other errors Jul 7, 2019 at 18:01
0

Include double dashes from the second exclude onward, and separate with tabs. Like this:

backup  server2:/var/   server2/    exclude=/var/cache/ --exclude=/var/lock/ --exclude=/var/log/ --exclude=/var/spool/ --exclude=/var/tmp/

Note the missing "--" for the first exclude. It's beyond me why this works, but it does.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .