1

Have cron email output to MAILTO based on exit status

view story
linux-howto

http://unix.stackexchange.com – I have a cron job running a php command like this: php /path/to/script.php > dev/null This should send only STDERR output to the MAILTO address. From what I gather the php script is not outputting any STDERR information even when its exit status is 1. How can I get the output of the php command (STDOUT) and only send it to MAILTO if the exit status is non-zero? (HowTos)