LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 07-31-2008, 01:37 PM   #1
htamayo
Member
 
Registered: Jan 2005
Location: san salvador, el salvador
Distribution: Debian Stable, UbuntuStudio Karmic Koala
Posts: 190

Rep: Reputation: 30
bad minute error adding a crontab job


Hi, I'm trying to add this contrab job:

30 9 * * * (chkrootkit -q > message 2>&1; diff -w whitelist message
| mail -es "chkrootkit output" me@gmail.com; rm -f message)

But I'm getting this error message:
"/tmp/crontab.MFodC1/crontab":3: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?

I tried to debug the line but I don't get where is the error, can uyou help me?

REgards
 
Old 07-31-2008, 03:30 PM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,684

Rep: Reputation: 54
The only thing I can see:
did you write all this to one line? Or have you put it like it is shown here?
Your commands should be on one line - else "|" is interpreted as the next lines "minutes" field.
 
Old 07-31-2008, 04:35 PM   #3
htamayo
Member
 
Registered: Jan 2005
Location: san salvador, el salvador
Distribution: Debian Stable, UbuntuStudio Karmic Koala
Posts: 190

Original Poster
Rep: Reputation: 30
You're right, in fact, the all command has to be in one single line, So, I undestood that you were saying that crontab is undestanding the command as 2 or even 3 line, I edited it and I typed as many words as I can fit in a single line then I tried to save it and it works, but the all command is not complete, so It doesn't work. My new question is: how can I type the all command, even if it took 2 lines, and crontab read it as a one single line?

regards
 
Old 07-31-2008, 04:45 PM   #4
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,684

Rep: Reputation: 54
Just type it on one line? Without linebreaks? Why would you _need_ to write it to more than one?
 
Old 07-31-2008, 09:38 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,241

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
Why don't you just put that in a script (shell file) and call that instead. Much less error prone.
BTW, normally cron has a minimal env, so its usually best to specify the complete path for each cmd eg

/usr/bin/diff instead of just 'diff' etc.
 
Old 07-31-2008, 11:49 PM   #6
sunils1973
Member
 
Registered: Jan 2007
Location: INDIA
Distribution: Ubuntu, Debian
Posts: 320

Rep: Reputation: 30
I think it is the problem with hour
the correct format is

mm hh dom month day of week command
i think it should be

30 09 * * * command
 
Old 08-01-2008, 12:18 AM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,241

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
A leading zero is not reqd: http://www.adminschoice.com/docs/cro...Crontab%20file
 
Old 03-15-2010, 08:56 AM   #8
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Rep: Reputation: 0
Crontab Error

Pls try to set the crontab in the following way.

1.save your command that you want to add to crontab to a file.
eg: /root/newcron.sh
2. set the execute permission to the file.
3. Add the crontab in following way.
30 9 * * * /root/newcron.sh

I think this will work for you.

Regards
Nikesh
 
  


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
crontab running twice in a minute saurabhrh Red Hat 4 01-30-2007 07:21 PM
crontab running twice in a minute saurabhrh Linux - General 1 01-30-2007 06:43 PM
crontab job Thulemanden Linux - Software 2 07-09-2006 06:57 AM
want to run program every minute, crontab???? poj Linux - General 4 09-19-2005 04:29 PM
adding a job to crontab via shell script tazio Linux - General 7 10-23-2003 02:44 PM


All times are GMT -5. The time now is 01:30 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration