[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

filter utility to send cron e-mail only if unexpected output

Title: filter utility to send cron e-mail only if unexpected output

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).

I started to write a wrapper script to take a command to execute and a file of
regular expressions defining expected output lines (like logcheck's ignore
files), to run the command and check against those regular expressions, and to
either suppress the output if everything is as expected or emit all output if
anything isn't as expected.

Since Debian has logcheck with its exclusions for log-file checking, I thought
maybe there's something with similar (regarding expected patterns) for cron
job commands.

(Plain text sometimes corrupted to HTML "courtesy" of Microsoft Exchange.) [F]

Reply to: