in reply to automated testing

By default, cron will mail anything that appears on STDOUT or STDERR. So all you need to do is to make sure your program is silent on success.

Note that the "only email on failure" has a failure mode: if the program doesn't run at all, for whatever reason, you won't notice. It's better to have the program report always - then an absence of a report can be noticed.

Replies are listed 'Best First'.
Re^2: automated testing
by Dru (Hermit) on Oct 29, 2010 at 19:20 UTC
    If you want to go this route, just add the "MAILTO" variable to the top of your crontab file or define it in .bash_profile (if that is the shell you are using). I personally use this method. I send the output of the scripts I don't care much about to the bit bucket and all others are emailed to me.
    MAILTO="<your email address>"
    Thanks,
    Dru

    Perl, the Leatherman of Programming languages. - qazwart
Re^2: automated testing
by Urthas (Novice) on Oct 29, 2010 at 16:30 UTC
    When a program always generates a report (including smooth, uneventful execution) you run the risk of missing errors simply by glossing over the report. I know it's stupid, but it's human. Programs should only report on failure, if it can be at all helped. If you define failure as including the case of not running at all, there needs to be some other mechanism in place for checking whether or not the program ran and generating a notification if not.
      When a program always generates a report (including smooth, uneventful execution) you run the risk of missing errors simply by glossing over the report.
      That's why you put the important fact (pass/fail) in the Subject, or first line of the report.

      Having to gloss over a report to find out whether it's about a failure or a success is wrong.

      Of course, if you get a gazillion reports a day, you can automate that as well: just have an addition program reporting to you which reports were failures, successes or passes. Just make sure *that* report gets send every day.

        But...you don't care what passed; it is, in turn, wrong to get a gazillion reports per day. Handling passed cases (i.e., parsing the subject line for PASS or FAIL, etc.) is just additional overhead. I'm not saying don't LOG, I'm just saying don't NOTIFY on success.
        argh I forgot to log in. The reply from anonymous monk is from me, Urthas. Apologies.