To: address@example.com
Subject: Subject
Content-Type: text/html; charset="us-ascii"
/* You can of course add more header lines if necessary. */
... your carefully crafted html content ...
#!/bin/ksh
#set -x
.
DATESTR=`date +"%Y-%m-%d_%H%M"`
DBALIST="Email id"
lckfile="/vac/home/scripts/log/$ORACLE_SID/"$DATESTR".log"
header="To: $DBALIST \nFrom: PATCH_INSTANCE@company.com \nSubject: Lock Report \nMIME-Version: 1.0 \nContent-Type: text/html; charset=us-ascii\n \n"
sqlplus -s -m "HTML ON" '/as sysdba' @SCRIPT_LOCATION/lock.sql >$lckfile"1"
if [ `fgrep 'No one requesting locks held by others' $lckfile"1" |wc -l` -ne 0 ]
then
echo "do nothing"
else
echo $header > $lckfile
echo " DBA Team," >> $lckfile
echo "
" >> $lckfile
echo " Please advise on the following locks" >> $lckfile
cat $lckfile"1" | grep -v 'Connected' >> $lckfile
echo "
" >> $lckfile
echo "
" >> $lckfile
echo "
" >> $lckfile
echo "opatch@IP_ADDRESS:/lock.sh Ver 1.0" >> $lckfile
cat $lckfile|/usr/lib/sendmail -t
fi
No comments:
Post a Comment