Next: The validate-html-notify
Script, Previous: The gnun-validate-html
Script, Up: GNUN Scripts [Contents][Index]
mailfail
ScriptThis is a helper script that runs a command, and mails the output of
that command in case it exits with a non-zero exit status.
mailfail
depends on GNU Mailutils, or a compatible
implementation, such as BSD’s mailx.
Usage:
mailfail [--dry-run] RCPT SUBJECT CMD [ARG ...]
The mailfail
script accepts the following options:
Does not send the email message.
The recipient of the message in a valid format, like
[email protected]
.
The subject of the message; if it is longer than a word you should guard it with quotes.
The command you want to run and send a mail in case it fails.
The arguments of CMD
, if any.
Here is a typical example, similar to the way it is used in GNUN:
mailfail [email protected] "Bad PO" msgfmt -cv -o /dev/null bg.po
This will check the validity of bg.po with the msgfmt
program and in case there are errors, a message will be sent to the
specified address with ‘Bad PO’ as subject and the error output from
msgfmt
as body.
mailfail
inherits the exit status of the command being run.
If an argument is missing, the usage information is printed to the
standard output and the exit code is 1.