On Sun, 16 Mar 2008 06:48:19 +0100, NN_il_Confusionario wrote: >> >> * * * * * root ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao >> >> *write|growisofs.*speed=' > /dev/null || logger get executed. >> >> PS. I'm sure the PATH is setup properly in my cron, so cron can find ps >> >> & grep. > > You could, for debugging pourposes: > * look at mails that cron sends if a commnd give any output; > * replace temporarilly the command with > set -x;echo $PATH;which ps;which grep;which find;which logger;ps -eaf | > grep -E ... > * replace the command with a shell script which executes the command in a > shell > with set -x and/or other shell debugging options; for example also > temporarilly drop redirection to /dev/null
Thanks a lot. With your suggestion, I found the reason -- it is as people (e.g. Raj) have suspected, it's problem of cron and quotes. Here is the execute log: Mar 17 17:28:01 cxmr /USR/SBIN/CRON[26757]: (root) CMD (set -x;which ps;which grep;ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' || logger get executed.) The mail that I got says: + which ps /bin/ps + which grep /bin/grep + ps -eaf + grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' root 26757 26756 0 17:28 ? 00:00:00 /bin/sh -c set -x;which ps;which grep;ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' || logger get executed. root 26761 26757 0 17:28 ? 00:00:00 grep -E cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed= I.e., somehow, the 'ps | grep' was able to find something in cron, whereas when executed directly under shell: $ ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed=' $ /bin/sh -c "ps -eaf | grep -E 'cdrecord.* -[dts]ao |cdrdao *write|growisofs.*speed='" I.e., if the same command are executed directly under shell the 'ps | grep' finds nothing. Anyone can give some explanation? Thanks -- Tong (remove underscore(s) to reply) http://xpt.sourceforge.net/techdocs/ http://xpt.sourceforge.net/tools/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]