LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Blank email on Cron job (http://www.linuxquestions.org/questions/linux-newbie-8/blank-email-on-cron-job-607982/)

Taleya 12-19-2007 06:08 PM

Blank email on Cron job
 
Heya guys

I'm trying to automate our RAID check results. When we invoke the command manually, it works fine and emails the results as intended. However, once we schedule it into a cron, we get a blank email

The command is:

tw_cli info c0 | /bin/mail -s "Current RAID Status: $HOSTNAME" foo@blahblah.com

This command works as intended. It just sends blank emails *only* via cron.

Anyone have any ideas? Driving me buggy :(

Uncle_Theodore 12-19-2007 06:56 PM

Try putting your command in a script and calling the script from cron.
For some weird reason cron sometimes doesn't recognize the pipe (|) symbol.

chrism01 12-19-2007 07:47 PM

Also, cron has a minimal to empty default env, so always specify complete/absolute paths to any cmd used.

Brian1 12-19-2007 07:52 PM

Run the mail command from the terminal and see if it mentions anything. I would assume it says " Null message body; hope that's ok " or something like that. Normally I would do it like this.
/bin/mail -s "Current RAID Status: $HOSTNAME" "foo@blahblah.com" < Text to send for body

Doing that command I think does not work and post same error. If I remember I have to send the data in the body I want sent to a file and then I can email the contents of the file.
Example: Use echo to send data to a file called data1

echo " data you want in the body of the message " > /etc/data1
/bin/mail -s "Current RAID Status: $HOSTNAME" "foo@blahblah.com" < /etc/data1

Brian


All times are GMT -5. The time now is 08:55 AM.