Re: filter utility to send cron e-mail only if unexpected output
On Wed, May 06, 2009 at 11:27:55AM -0400, Barclay, Daniel wrote:
> Does Debian have any utility to address the following situation?
> I have some scripts that I run both manually and as cron jobs. The scripts
> generate stdout/stderr output reporting what they're doing.
> I want to see the output when I run the scripts manually. However, when the
> scripts are run by cron, normally I don't want cron to e-mail me that bulky
> output for each run--I want the output (the full output) only when the output
> is different than expected (e.g., if something has gone wrong or has changed,
> which I want to notice).
Why not rewrite the scripts to take a command-line option such as either
-q (quiet) or -v (verbose), and have it print out the required detail
depending on the option? Then have that option supplied by cron when
its run (or by you when you run it manually).