Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Telephone Alerts

RE: Telephone Alerts

From: FOX, Simon <Simon.FOX_at_crewe.sema.slb.com>
Date: Mon, 13 May 2002 08:58:32 -0800
Message-ID: <F001.0045F71D.20020513085832@fatcity.com>


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

CONTACT=putyourcellphonenumberhere_at_messaging.nextel.com SCRIPTOUTPUT=$OUTPATH/$1.out
USERNAME=$2
PASS=$3 #---Clean out the output file---
cat /dev/null>$SCRIPTOUTPUT

#---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


Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
-- 
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US