Thanks for this. My rsync backup scripts are so basic that they are a disaster waiting to happen.
My requirements are a little different and before I go tying myself in nots I wanted to run a couple of things past you.
My destination is on another networked device. I'm assuming the following target is fine:
[email protected]::data
To gain access to that network device, rsync needs a password. It currently starts like this:
rsync --password-file=/mnt/cache/apps/rsync/.rsyncpwd
I'm assuming I can change your script to the following without any issues:
else
rsync --password-file=/mnt/cache/apps/rsync/.rsyncpwd -avih --delete --stats --include-from=$rsyncincludes --exclude=* --log-file=/tmp/$rsynclog $source $target
fi
Not sure if you feel like coding the location and name of a password file for rsync, but that would be cool.
*******************
Thought I would try it before I post. I am getting errors
[->] Subject: ### rsync_backup_to_external.sh" ###
[->]
[->] Error: target backup location (
[email protected]::data) does not exist!
[->] .
[<-] 250 2.0.0 OK 1355316866 o5sm15777877paz.32
[->] QUIT
[<-] 221 2.0.0 closing connection o5sm15777877paz.32
The destination is there as my old code works fine:
rsync --password-file=/mnt/cache/apps/rsync/.rsyncpwd -vrHltD --delete --stats /mnt/user/data/
[email protected]::data
and the logs show it's working.
I tried replacing $target with
[email protected]::data in your script but I got the same errors.
Any ideas ? I've modified both rsync commands in your script to start run with the password file:
rsync --password-file=/mnt/cache/apps/rsync/.rsyncpwd -avih --dry-run --delete --stats --include-from=$rsyncincludes --exclude=* --log-file=/tmp/$rsynclog $source $target