[Dirvish] sending mail on any failure
Eric Searcy
emsearcy at gmail.com
Thu Apr 16 16:17:56 UTC 2009
> Yes, basically. Except I don't want it mailing me at all if there is
> not an error. I also want it mailing me on ANY error - in the rsync or
> pre/post scripts.
We followed a typical "output=error" scenario.
We were running dirvish-runall with --quiet, so the only output there
was from dirvish itself when a vault or script failed.
However, we didn't want to have to track down what the error was when a
vault failed, so I set up a post-server script based on some ideas from
the wiki that would email what the dirvish error was. Here's the
relevant part:
# Return on success or warning if non-verbose mode
if [ $VERBOSE -eq 0 -a \( $DIRVISH_STATUS = "success" -o \
$DIRVISH_STATUS = "warning" \) ]; then
exit 0
fi
# Choose files to output
FILELIST="$DIRVISH_DEST/../summary"
if [ -f $DIRVISH_DEST/../rsync_error ]; then
FILELIST="$FILELIST $DIRVISH_DEST/../rsync_error"
fi
# Create email
cat $FILELIST | mail -s \
"Dirvish $DIRVISH_CLIENT: $DIRVISH_STATUS" \
$DSTADDR
Summary for this, which I think matches what you want, but YMMV:
* Run dirvish so that it only outputs on errors (causing cron mail).
This means "dirvish-runall --quiet" and no --summary option to "dirvish"
itself. This will give only general info, like "post-server failed" I
think.
* Have your scripts generate output on errors. This provides fuller
debugging for them.
* Use a post-server script as above to provide fuller dirvish debugging
info when needed.
Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://www.dirvish.org/pipermail/dirvish/attachments/20090416/3bea402f/attachment.bin
More information about the Dirvish
mailing list