LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-25-2017, 11:18 AM   #1
rijo79
LQ Newbie
 
Registered: Oct 2013
Posts: 8

Rep: Reputation: Disabled
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.
 
Old 02-25-2017, 11:32 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
The % is a special character with cron and needs to be escaped i.e. add a \ before.
 
Old 02-25-2017, 01:03 PM   #3
rijo79
LQ Newbie
 
Registered: Oct 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
That did the trick. Thank you very much.
 
Old 02-25-2017, 01:35 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Good.

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


Reply

Tags
backups, cron, daily



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron for root stopped working after OS update gprichardson1 Red Hat 1 03-28-2012 10:42 AM
[SOLVED] Cron for root stopped working after OS update gprichardson1 Red Hat 1 03-28-2012 10:17 AM
Command not working in cron job, but works fine in root Roosta21 Linux - Software 4 11-22-2007 08:08 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration