Created
February 9, 2016 10:53
-
-
Save delormev/8c69315a44288410f0e8 to your computer and use it in GitHub Desktop.
Prepend "notify" before a command to get notified of its status and output by email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
output=`$* 2>&1 | tee /dev/stdout; echo ${PIPESTATUS[0]}` | |
rv=`echo "$output" | tail -1` | |
label="[FAILED] " | |
if [ "$rv" -eq 0 ]; then | |
label="[SUCCESS] " | |
fi; | |
echo "$output" | mail -s "$label" your.email@gmail.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment