Empty email when the script run as a cron job
I've got a script that check for hard-drive temperature and send an email if one of the hard-driver is too hot. This script run perfectly when running "by hand", but once added to the crontab, it mostly works, but the emails sent are empty while its subject is OK!!! I know that cron environment is not a full user environment but I can't figure where the problem stand (what environment variable I'm missing).
Here's my script:
and by crontab:
If I do not erase the temporary file, the email is still empty, but the file contents the message I want to send.
If the message content is not in a variable, I'm receiving it...
So it looks like my problem is relative to both variable and redirection handling by cron, but I can't fix this.
Does anybody have an idea?
My system is a Scientific Linux 6.3 up to date
Try to execute /etc/profile in the head of the script such as:
I had such problem and this fixed it.
Thank you for your suggestion, I'll try it monday
Thank you it works.
But if anybody can explain to me how a variable content can disappear when piped, i'll be happy...
Ahhh bash black magic.
|All times are GMT -5. The time now is 01:39 AM.|