iankelling.org
/
git
/
log-quiet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
add script for prometheus logging of systemd service failures
[log-quiet]
/
failmail
diff --git
a/failmail
b/failmail
index 6360c7e31c0d84d7d3e2262adc925154683417a1..c420465829dafb1e1873ebc6445ca9a596a7a2be 100755
(executable)
--- a/
failmail
+++ b/
failmail
@@
-32,8
+32,10
@@
if [[ $MAILTO ]]; then
fi
t=$(mktemp)
-if ! "$@" &>"$t"; then
- mail -s "$HOSTNAME: $*" $mailto <"$t"
+code=0
+"$@" &>"$t" || code=$?
+if (( code )); then
+ mail -s "$HOSTNAME: code: $code cmd: $*" $mailto <"$t"
rm "$t"
fi
exit 0