diff options
Diffstat (limited to 'tools/mail_error')
-rwxr-xr-x | tools/mail_error | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tools/mail_error b/tools/mail_error deleted file mode 100755 index aabb579c..00000000 --- a/tools/mail_error +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# mail_error -o file -m email_address command -# Runs command from cron and redirects all output to file -# If command rc != 0, sends output to email_address - -function die { echo $1 ; exit 1; } - -# Must be export so that sfsnapshot uses correct versions -# of GNU toolchain -export PATH=$HOME/bin:$HOME/local/bin:$PATH - -while getopts "o:m:" c; do - case $c in - o) output_file=$OPTARG;; - m) email=$OPTARG;; - \*) echo "oops";; - esac -done -shift $(($OPTIND-1)) - -[[ -z $1 ]] && die "Must specify command" - -if ! "$@" > $output_file 2>&1 ; then - mail -s "mail_error fail: $1" $email < $output_file -fi |