/etc/cron.daily/foo does not work. The script output is not sent to firstname.lastname@example.org .
The page at http://www.unixgeeks.org/security/newbie/unix/cron-1.html also suggests a simple solution:
/etc/cron.daily/foo now contains the following:
/usr/bin/script 2>&1 | mailx -s "$0" email@example.com
This will send an email to 'firstname.lastname@example.org' with the subject which is equal to the full path of the script (e.g.
Here's what Unixgeeks.org says about this:
Output from cron
As I've said before, the output from
cron gets mailed to the owner of the
process, or the person specified in
the MAILTO variable, but what if you
don't want that? If you want to mail
the output to someone else, you can
just pipe the output to the command
cmd | mail -s "Subject of mail" user
Sometimes, I only want to receive the errors from a cronjob, not the stdout, so I use this trick. The syntax may look wrong at first glance, but rest assured it works. The following cronjob will send STDOUT to /dev/null, and will then handle STDERR via the pipeline.
doit 2>&1 >/dev/null | mailx -s "$0" email@example.com
Same thing, but send to syslog:
doit 2>&1 >/dev/null | /usr/bin/logger -t $ME
Also see my answer on ServerFault to Cronjob stderr to file and email