LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Root cron not working (https://www.linuxquestions.org/questions/linux-server-73/root-cron-not-working-4175600573/)

rijo79 02-25-2017 11:18 AM

Root cron not working
 
Hey guys. I've set up two cron jobs under root to do daily incremental and weekly full backups to an S3 instance and then send an email when complete. The email is sent to root@localhost and I have postfix config'd to forward root's mail to a virtual user. If I copy and paste them into a terminal, the commands work perfectly. However the cron jobs do not run at 3 am as they are supposed to. I'm stumped. Don't know why this isn't working. Here are the output from crontab -l:

Code:

00  03  *  *  1-6  /usr/local/bin/db_dump.sh && /usr/bin/duply srv1-bak backup && echo "Daily incremental backup for `date '+%d-%m-%Y'` complete at `date '+%H:%M:%S'`" | /usr/bin/mail -s "Backup complete" root@localhost
00  03  *  *  7  /usr/local/bin/db_dump.sh && /usr/bin/duply srv1-bak full && echo "Weekly full backup for `date '+%d-%m-%Y'` complete at `date '+%H:%M:%S'`" | /usr/bin/mail -s "Backup complete" root@localhost

Any pointers would be much appreciated.

michaelk 02-25-2017 11:32 AM

The % is a special character with cron and needs to be escaped i.e. add a \ before.

rijo79 02-25-2017 01:03 PM

That did the trick. Thank you very much.

michaelk 02-25-2017 01:35 PM

Good.

You can mark the thread as solved via the thread tools pull down menu at the top.


All times are GMT -5. The time now is 03:02 AM.