Created
July 12, 2012 10:09
-
-
Save stringfellow/3097173 to your computer and use it in GitHub Desktop.
Bash wrapper script to silence cron if there are no errors, and print out if there are
This file contains hidden or 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/bash | |
logfile=$$.log | |
exec 6>&1 | |
exec > $logfile 2>&1 | |
$* | |
RETVAL=$? | |
exec 1>&6 6>&- | |
if [ $RETVAL -ne 0 ]; then | |
echo "FAILURES:" | |
cat $logfile | |
fi | |
rm $logfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment