LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2015, 03:50 AM   #1
omniok
LQ Newbie
 
Registered: May 2014
Posts: 15

Rep: Reputation: Disabled
Crontab Entry not working


Hi,

I have the following entry in crontab.

30 17 * * * rm -rfv /backup/alfresco_bkp/alf_data_backup/`date -d '-2 days' '+%d%m%y'` {} \; >> /backup/alfresco_bkp/alf_data_backup/deletionLog.log 2>&1

This command executes properly when run manually. However, it does not work in crontab. Can some one please tell the reason and solution for this?
There some other entries as well in the crontab and are working fine.

Thank you in advance !!!
 
Old 02-23-2015, 07:25 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
% is a special character in crontab and you have not escaped them with backslash (\).
 
Old 02-24-2015, 01:09 AM   #3
omniok
LQ Newbie
 
Registered: May 2014
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by linosaurusroot View Post
% is a special character in crontab and you have not escaped them with backslash (\).
Thanks lino, can you please tell me if the following crontab entry is correct?

30 17 * * * rm -rfv /backup/alfresco_bkp/alf_data_backup/`date -d '-2 days' '+\%d\%m\%y'` {} \; >> backup/alfresco_bkp/alf_data_backup/deletionLog.log 2>&1
 
Old 02-24-2015, 07:41 AM   #4
omniok
LQ Newbie
 
Registered: May 2014
Posts: 15

Original Poster
Rep: Reputation: Disabled
Thank you very much lino
It worked when backslash was inserted. So the correct command is "30 17 * * * rm -rfv /backup/alfresco_bkp/alf_data_backup/`date -d '-2 days' '+\%d\%m\%y'` {} \; >> backup/alfresco_bkp/alf_data_backup/deletionLog.log 2>&1"
 
  


Reply


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
about crontab entry Ravi kumar Linux - Software 2 09-16-2008 02:41 PM
Somehow not getting crontab entry right Jykke Linux - Desktop 4 02-29-2008 02:50 PM
crontab entry? Master Fox Linux - Software 4 08-23-2005 02:20 PM
crontab entry pilipk01 Linux - General 4 11-19-2003 08:53 PM


All times are GMT -5. The time now is 09:53 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