-   Linux - Newbie (
-   -   Blank email on Cron job (

Taleya 12-19-2007 07: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"

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 07: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 08: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 08: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" "" < 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" "" < /etc/data1


All times are GMT -5. The time now is 07:43 PM.