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: Jack Silvey <jack_silvey_at_yahoo.com>
Date: Mon, 13 May 2002 05:53:24 -0800
Message-ID: <F001.0045F432.20020513055324@fatcity.com>


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).
Received on Mon May 13 2002 - 08:53:24 CDT

Original text of this message

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