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 |
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. |
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 |
Just type it on one line? Without linebreaks? Why would you _need_ to write it to more than one?
|
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. |
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 |
A leading zero is not reqd: http://www.adminschoice.com/docs/cro...Crontab%20file
|
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 |
All times are GMT -5. The time now is 05:17 PM. |