rsync/cron
Posted: 2017/12/12 12:03:13
I've searched the archives for help with this, a couple of things came close but did not help me.
I was running a weekly cron job that sent some files to backup to an offsite server. It was working well, so I thought I should try to do it every day for a more robust backup solution, and that's where I got hung up. I want to backup to to a directory based on the day of the week, it seems cron doesn't like that since the exact same command works from the command line. Here is the line from cron:
The only thing different between this line and the weekly cron job that works is the "/bin/date" part, so I'm assuming that is the sticky point, but I can't figure out how else to do it. If I don't escape the "%" in the date line it fails immediately. If I slap an "echo" at the front of the cron job, I get this, which correctly uses the DOTW as the directory:
Any help appreciated.
I was running a weekly cron job that sent some files to backup to an offsite server. It was working well, so I thought I should try to do it every day for a more robust backup solution, and that's where I got hung up. I want to backup to to a directory based on the day of the week, it seems cron doesn't like that since the exact same command works from the command line. Here is the line from cron:
Code: Select all
/usr/bin/rsync -avzhe "ssh -p 222" --exclude-from '/home/laca/exclude.jb' /mnt/tom1/backups/jbserver/jbserver laca@****.dyndns.org:/media/laca/`/bin/date +\%A`/
Code: Select all
/usr/bin/rsync -avzhe ssh -p 222 --exclude-from /home/laca/exclude.jb /mnt/tom1/backups/jbserver/jbserver laca@****.dyndns.org:/media/laca/Monday/