Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Telephone Alerts
Thanks for this detailed reply. I shall take this further.
-----Original Message-----
Sent: 13 May 2002 14:53
To: Multiple recipients of list ORACLE-L
Simon,
Many cellphone providers provide a service whereby an email recieved at a specific address is sent on to a mobile phone in the form of a page.
Here is the routine that I use to scrape my output logs and send a success or failure page to my cellphone:
#!/bin/ksh
# shell script to run sql scripts and contact the user
with succes or failure
# Jack Silvey
#---Oracle variable section ---
export ORACLE_SID=iron
export ORACLE_HOME=/u01/app/oracle/product/8.1.7
#---shell variable section ---
SCRIPTPATH=/u01/app/oracle/admin/iron/scripts SQLPATH=$SCRIPTPATH/sql SCRIPTNAME=$SQLPATH/$1 OUTPATH=$SCRIPTPATH/output
#---Run the SQL*Plus script, storing results in a
variable---
SQLRESULTS=`sqlplus /nolog @$SCRIPTNAME> $SCRIPTOUTPUT
< $SQLPATH/endsql.sql`
#---Check the command-line return code---
SCRIPTERROR=$?
#---Check to make sure output doesn't contain SQl*PLUS
errors---
cat $SCRIPTOUTPUT|grep "SP2-"
GREPOUTPUT=$?
if [[ $GREPOUTPUT -eq 0 ]] then
SCRIPTERROR=`expr $SCRIPTERROR + 1`
fi
#---Check to make sure output doesn't contain Oracle
errors---
cat $SCRIPTOUTPUT|grep "ORA-"
GREPOUTPUT=$?
if [[ $GREPOUTPUT -eq 0 ]] then
SCRIPTERROR=`expr $SCRIPTERROR + 1`
fi
#---Check to make sure the resulting variable doesn't
contain errors---
echo $SQLRESULTS|grep "SP2-"
GREPOUTPUT=$?
if [[ $GREPOUTPUT -eq 0 ]] then
SCRIPTERROR=`expr $SCRIPTERROR + 1`
fi
echo $SQLRESULTS|grep "ORA-"
GREPOUTPUT=$?
if [[ $GREPOUTPUT -eq 0 ]] then
SCRIPTERROR=`expr $SCRIPTERROR + 1`
fi
--this section pages the dba with success or failure--
if [[ $SCRIPTERROR -ne 0 ]] then
echo $1 failed | mailx $CONTACT
exit 99
else
echo $1 successful | mailx $CONTACT
fi
hth,
Jack Silvey
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jack Silvey INET: jack_silvey_at_yahoo.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). ___________________________________________________________________________ This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of SchlumbergerSema. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify the SchlumbergerSema Helpdesk by telephone on +44 (0) 121 627 5600. ___________________________________________________________________________ -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: FOX, Simon INET: Simon.FOX_at_crewe.sema.slb.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon May 13 2002 - 11:58:32 CDT
![]() |
![]() |