Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help in unix script
#!/bin/ksh
MAX=40
top -b -U norad | grep norad | awk '{ print $6, $11 }' | \
while read SIZE COMMAND
do
#echo "working with ${SIZE}:${COMMAND}" #DEBUG
WORK="${SIZE#*M}"
#echo "1->${WORK}" #DEBUGif [[ ${#WORK} -eq 0 ]]
#echo "2->${WORK}" #DEBUGif [[ ${WORK} -ge ${MAX} ]]
Brian P. MacLean
Oracle DBA, OCP8i
"Mandal, Ashoke" <ashoke.k.mandal_at_medt To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> ronic.com> cc: Sent by: Subject: Help in unix script root_at_fatcity.com 03/28/02 09:28 AM Please respond to ORACLE-L
Greetings all,
I need to do the following
unix> top -b -U norad
PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
12733 norad 1 60 2 3936K 3392K run 0:05 7.21% dbganlz 12747 norad 4 52 2 13M 10M sleep 0:05 4.20% dbgora 12721 norad 1 53 2 3160K 2584K sleep 0:00 0.12% dbgsam 12726 norad 1 52 2 3184K 2416K sleep 0:00 0.02% dbgalert 12740 norad 1 53 2 2992K 2128K sleep 0:00 0.02% dbgrepos 12594 norad 1 59 0 3200K 2544K sleep 0:00 0.01% dbgsam 12606 norad 1 59 0 4696K 4160K sleep 0:11 0.00% dbganlz 12620 norad 4 59 0 42M 13M sleep 0:06 0.00% dbgora 12599 norad 1 58 0 3216K 2400K sleep 0:00 0.00% dbgalert 12613 norad 1 59 0 3016K 2112K sleep 0:00 0.00% dbgrepos
I have to check the last character of SIZE column. If the size is in M(megabyte) then check if the value is > 40 then send an e-mail with the COMMAND name and the size. Something like "dbgora has a size of 42M"
I was trying the following script. But I am not sure how to get the last character of SIZE column from the above output and compare with 'M' and then compare with the value.
top -b -U norad | grep norad | awk '{ print $6, $11 }' | \
while read SIZE COMMAND
do
echo "Command : $COMMAND Size : $SIZE"
done
Any suggestions will be appreciated.
Thanks,
Ashoke
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Mandal, Ashoke INET: ashoke.k.mandal_at_medtronic.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-LReceived on Thu Mar 28 2002 - 12:03:22 CST
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Brian_P_MacLean_at_eFunds.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).