iankelling.org
/
git
/
log-quiet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sysd-mail-once missing email on 1 error, minor improvements
[log-quiet]
/
failmail
diff --git
a/failmail
b/failmail
old mode 100644
(file)
new mode 100755
(executable)
index
703e130
..
6360c7e
--- a/
failmail
+++ b/
failmail
@@
-14,19
+14,26
@@
# limitations under the License.
case $1 in
# limitations under the License.
case $1 in
-
-h|--help)
-
cat <<'EOF'
-usage:
log
mail CMD [ARGS...]
+ -h|--help)
+ cat <<'EOF'
+usage:
fail
mail CMD [ARGS...]
Send mail in case of failure of CMD
Send mail in case of failure of CMD
+
+Emails to $MAILTO or if unset, $USER@localhost
EOF
EOF
-
exit 0
-
;;
+ exit 0
+ ;;
esac
esac
+mailto=$USER@localhost
+if [[ $MAILTO ]]; then
+ mailto=$MAILTO
+fi
+
t=$(mktemp)
if ! "$@" &>"$t"; then
t=$(mktemp)
if ! "$@" &>"$t"; then
-
mail -s "$HOSTNAME: $*" $USER@localhost
<"$t"
-
rm "$t"
+
mail -s "$HOSTNAME: $*" $mailto
<"$t"
+ rm "$t"
fi
exit 0
fi
exit 0