#!/usr/bin/sh ### Precautionary measures unset IFS PATH=/usr/bin:/usr/local/bin ### Set variables to="user1@domain.com,user2@domain.com" from="Deployment Center" subject="Deployment ERROR Notification" basedir=/site/deploy/jobs send_mail=`whereis sendmail | cut -f2 -d" "` jobs=`{ cd $basedir; find * -name "joberr.txt" -size +0 -mtime -1; }` ### Main logic if [ "`dirname $send_mail`" = "." ]; then echo "'sendmail' not found." 1>&2 exit 1 fi if [ "$jobs" ]; then $send_mail -F "$from" -n -t << EOM MIME-Version: 1.0 To: $to Subject: $subject Importance: High Content-Type: text/plain The following deployment job(s) produced errors: `for i in $jobs; do echo "https://internalserver.com:port$basedir/$i"; done` Click on the link for more details. EOM fi