Home » Infrastructure » Linux » Sleep function (Oracle 10.2.0.3 ,Linux AS4)
Sleep function [message #414789] Thu, 23 July 2009 08:16 Go to next message
rsreddy28
Messages: 295
Registered: May 2007
Senior Member
Hi All,

I'm using a shell script to grab all the ORA errors of the database and send a mail. This is working fine but I want a small modification to this script . Below is the script

 
# Alert Log Error Notification Script
#!/bin/sh
#

. $HOME/.bash_profile
DBALIST=xyz@abc.com
pslist=`ps -fu oracle |grep pmon |grep -v grep |cut -d'_' -f3 |grep -v '+ASM'`
for i in $pslist
do
dbname=`echo -n $i | head -c -1`
echo $dbname
cd /opt/oracle/admin/$dbname/bdump
if [ -f alert_$i.log ]
then
echo alert_$i.log
 grep ORA- alert_$i.log > /home/oracle/dba/script/alert.err
echo `pwd`
if [ `cat /home/oracle/dba/script/alert.err|wc -l` -gt 0 ]
then
 mailx -s "${dbname} ORACLE ALERT ERRORS" $DBALIST <  /home/oracle/dba/script/al
ert.err
echo "Alert in " $dbname
DATETIME="`date '+%y%m%d'`_`date '+%H%M%S'`"
mv alert_$i.log alert_${dbname}_${DATETIME}.log
touch alert_$i.log
fi
fi
done



The Modification is to pause/sleep for 5 mins before moving to the new alert log file .

Can somebody help me on this .

Thanks,
Raj
Re: Sleep function [message #414793 is a reply to message #414789] Thu, 23 July 2009 08:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use "sleep"?

Regards
Michel
Re: Sleep function [message #414872 is a reply to message #414793] Thu, 23 July 2009 22:49 Go to previous messageGo to next message
rsreddy28
Messages: 295
Registered: May 2007
Senior Member
Michel,

Yes , Sleep can be used to pause the command to invoke after a certain time , but I'm not quiet sure how to use that in my script .

Will be helpful if you can suggest me on this .


Thanks
Re: Sleep function [message #414874 is a reply to message #414789] Thu, 23 July 2009 22:53 Go to previous message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
sh -x  when.sh
+ date
+ echo Thu Jul 23 20:52:48 PDT 2009
+ sleep 5
+ date
+ echo Thu Jul 23 20:52:54 PDT 2009
+ cat capture.log
Thu Jul 23 20:52:48 PDT 2009
Thu Jul 23 20:52:54 PDT 2009
Previous Topic: VM and Linux Installation
Next Topic: Deleting old Trace files
Goto Forum:
  


Current Time: Sat Dec 03 01:29:27 CST 2016

Total time taken to generate the page: 0.08264 seconds