CentOS 5.5 x86_64
Trying to e-mail a periodic system update with the output of a system temperatures command:
hpasmcli -s "show temp"
Outputs something like:
Sensor Location Temp Threshold
------ -------- ---- ---------
#1 AMBIENT 21C/69F 42C/107F
...
So, I script this:
#!/bin/bash
hpasmcli -s "show temp" > /tmp/monitorTemp.log &
wait
mail -s "temperature" me@mydomain.com < /tmp/monitorTemp.log
rm -f /tmp/monitorTemp.log
Set to run every hour in cron
* */1 * * * /root/monitorTemp.sh
I receive the e-mail, but it's empty. However, if I simply run it from the command line ./monitorTemp.sh it sends me the e-mail with command output included!
What am I missing?
/path/to/hpasmcli -s "show temp" | mail -s "temperature" me@mydomain.com- the whole script on one line (plus the shebang). – Dennis Williamson Nov 17 '10 at 4:17