LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-29-2006, 11:34 PM   #1
shafey
Member
 
Registered: Aug 2005
Posts: 47

Rep: Reputation: 15
Crontab problem


What's problem in this syntax of crontab
0 5 * * 1,3,6 mysqldump dbname > /home/backup/manualy/mysql/filename-`date +%d-%m-%y`.sql

I need to run mysql backup day by day at 05:00 AM, I tried the command and it's working properly but cron not running .. what's wrong ?
 
Old 10-30-2006, 01:06 AM   #2
Freemor
Member
 
Registered: Aug 2005
Location: New Brunswick
Distribution: Trisquel
Posts: 70
Blog Entries: 8

Rep: Reputation: 15
The syntax look fine to me .. but I had similar problems setting up a cron job to do some PVR work for me.. in my case the solution was to move the more complex command into a bash script and then use cron to call the script. I never figured out why it didn't work straight from cron but suspected it had to do with the use of the `date +%m%d` I use in the command.

it all works fine now.

Hope this helps
Freemor
 
Old 10-30-2006, 03:20 AM   #3
shafey
Member
 
Registered: Aug 2005
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks

hi ali

i have got the Right syntax

0 5 * * 1,3,6 mysqldump dbname > /home/backup/manualy/mysql/$(date +%d-%m-%y)
 
Old 10-30-2006, 11:36 AM   #4
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
If you're inclined to read the friendly manual , it tells you:
Quote:
Originally Posted by man 5 crontab
Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
E.g., here's a line from my crontab
Code:
33 3 * * * /home/monet/finance/script/consolidate 5 \%Y-\%m-\%d '??-??-??'
(And, as you have guessed, date uses that format.)
 
Old 10-31-2006, 12:09 AM   #5
linux2man
Member
 
Registered: Oct 2006
Posts: 34

Rep: Reputation: 16
Many Thanks
Problem fixed
 
  


Reply



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
crontab problem sunnyanthony Linux - Software 1 01-07-2006 04:48 AM
crontab problem pdrobe Red Hat 1 02-05-2005 03:19 PM
crontab problem provo1234 Linux - General 3 01-21-2005 11:20 AM
crontab problem BlackRabbit Linux - General 9 06-17-2004 07:38 AM
crontab problem zuessh Slackware 0 04-30-2003 09:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

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