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.

Thomas
  • 4,225
  • 5
  • 23
  • 28

1 Answers1

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.

rsuarez
  • 384
  • 5
  • 11