[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What's the problem with this cron command



T o n g wrote:
Hi,
Please take a look at the following cron task:

 * * * * *	root	ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' > /dev/null || logger get executed.

It bewilders me that it is not doing what I want. Here is the syslog
when it is run:

 Mar 15 13:15:02 cxmr /USR/SBIN/CRON[22779]: (root) CMD (ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' > /dev/null || logger get executed.)
 Mar 15 13:15:02 cxmr /USR/SBIN/CRON[22780]: (root) CMD ...

I.e., I want to execute a cron task if I'm not burning CD/DVD. But the
actual command never get executed, even when I'm not burning CD/DVD. If I
redo the command from the command line, it is fine:
 $ (ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' > /dev/null || logger get executed.)

Did you try placing it in some file and executing that file from cron? It could be some problem with the parsing of quotes.


 $ tail /var/log/syslog
 Mar 15 13:16:27 cxmr tong: get executed.

So, what is the problem?
PS. I'm sure the PATH is setup properly in my cron, so cron can find ps &
grep.

Thanks



--
Raj Kiran Grandhi
--
At the source of every error which is blamed on the computer, you will find at least two human errors, including the error of blaming it on the computer.


Reply to: