With this cron script I am trying to get Rsync to work
*/1 * * * * /root/backup.sh `date +today/\%M`
And a shell script as the one below
#!/bin/bash -x PATH=/bin:/usr/bin:/sbin:/usr/sbin REMOTE="REMOTEADDRESS" RSYNC=/usr/bin/rsync
Comment: This works
$RSYNC -aqz --exclude-from '/home/root/backups/backup-exclude.txt' /var/www/html $REMOTE:backups/
Comment: This fails
$RSYNC -aqz --exclude-from '/home/root/backups/backup-exclude.txt' /var/www/html $REMOTE:$1/
I am unable to understand why the passed parameter does not get passed correctly to the script. In the log everything looks as it should.
UPDATE The reason for the cron to pass the parameter and not have it in the script is to have a backup schedule that allows to have : - a backup each hour overwritten each day - a backup each day overwritten each month - a persistent Backup each month
The error when passing the parameter is that RSync can not mkdir on the remote server. It can with any static line. The log shows the correct directory passed when using the current cron.