|
Re: Need Help for write script [message #593941 is a reply to message #593938] |
Thu, 22 August 2013 02:52   |
 |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Something like (not tested, please do it and post the final script):
for i in {1..6}
do
sqlplus user/password@db <<EOF
exec your_procedure
exit
EOF
if [ $? -eq 0 ]; then exit 0; fi
sleep 1800
done
(echo "From: <sender email>"
echo "To: <to email>"
echo "Subject: <your subject>"
echo "Content-Type: text/ascii"
echo "Content-Disposition: inline"
echo "<your text>"
) | sendmail <to email>
exit 1
Note: the 3 empty lines are mandatory, they are there to handle the case the database is not available.
Regards
Michel
[Edit: Add send mail]
[Updated on: Thu, 22 August 2013 02:57] Report message to a moderator
|
|
|
|
|
|
Re: Need Help for write script [message #593966 is a reply to message #593960] |
Thu, 22 August 2013 05:17   |
 |
sureshram24
Messages: 13 Registered: August 2013 Location: Bangalore
|
Junior Member |
|
|
Thank you so much. So can i use below checks to be done after the above code(oracle connection).
Procedure_checks()
{
# Check for file existence
if [ -f run_procedure.txt ]
then
print "\n run_procedure.txt found"
# Obtain the number of error messages
oract=`grep -c "ORA-" run_procedure.txt`
spct=`grep -c "SP2-" run_procedure.txt`
errct=`grep -c -i "error" run_procedure.txt`
# Report on the status of the log files
if [ "$oract" = "0" ] && [ "$spct" = "0" ] && [ "$errct" = "0" ]
then
print "Appears to be good."
else
print "Appears to have a problem."
ERR_FLAG=5
fi
# Regardless of errors print out the results
print " There are ($oract) Oracle errors"
print " There are ($spct) SQLPLUS errors"
print " There are ($errct) general errors"
else
print "**** Oracle Check Failed: Oracle log file not found ****"
ERR_FLAG=6
fi
print "\n**** Oracle Check Complete ****"
print "\n "
}
[Edit MC: add code tags for readability]
[Updated on: Thu, 22 August 2013 06:55] by Moderator Report message to a moderator
|
|
|
Re: Need Help for write script [message #593983 is a reply to message #593966] |
Thu, 22 August 2013 06:56  |
 |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Yes, something like that, now the usage will show you if you need some modification or not, this depends on your environment (organization and so).
Regards
Michel
|
|
|