LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 12:18 PM   #1
rijo79
LQ Newbie
 
Registered: Oct 2013
Posts: 6

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, 12:32 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,488

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

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

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
Good.

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


Reply

Tags
backups, cron, daily


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:42 AM
[SOLVED] Cron for root stopped working after OS update gprichardson1 Red Hat 1 03-28-2012 11:17 AM
Command not working in cron job, but works fine in root Roosta21 Linux - Software 4 11-22-2007 09: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 02:57 AM

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

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration