#!/bin/bash msg="" accountInfo=$(ssh cipres@comet.sdsc.edu "show_accounts | grep sds121") let avail=$(echo $accountInfo | grep sds121 | awk '{print $4}') ; let used=$(echo $accountInfo| grep sds121 | awk '{print $5}') ; diff=$((avail - used)); if (( $diff <= 500000 )) ; then msg="$msg COMET: remaining SUs is $diff which is less than 500,000. " fi accountInfo=$(ssh cipres@gordon.sdsc.edu "show_accounts | grep sds121") let avail=$(echo $accountInfo | grep sds121 | awk '{print $4}') ; let used=$(echo $accountInfo| grep sds121 | awk '{print $5}') ; diff=$((avail - used)); if (( $diff <= 500000 )) ; then msg="$msg GORDON: remaining SUs is $diff which is less than 500,000. " fi #Warning at 5000 remaining on tscc accountInfo=$(ssh cipres_test@tscc.sdsc.edu "gbalance -u cipres_test | grep cipres_test") let balance=$(echo $accountInfo | awk '{print $5}'); if (( $balance <= 5000)); then msg="$msg TSCC: balance SUs is $balance which is below 5000. " fi if [ "$msg" ] ; then echo $msg | mail -s "Alert: Running out of SUs" terri@sdsc.edu, mmiller@sdsc.edu, phoover@sdsc.edu fi