: "@(#)shar.sh 1.8" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Friday February 25 13:05:38 GMT 2000 by informix # # Files archived in this archive: # onprocs # readme.onprocs # #-------------------- if [ -f onprocs -a "$1" != "-c" ] then echo shar: onprocs already exists else echo 'x - onprocs (1950 characters)' sed -e 's/^X//' >onprocs <<'SHAR-EOF' X# onprocs : shell script to see which stored procedures are being executed X# : at any given point in time. X# written by : Obnoxio The Clown X# date : 18 February 2000 X X# Allow -r option as other Informix monitoring tools do X X# set up defaults X XITERATIONS=1 XSLEEPTIME=5 XERROR=0 XVERBOSE=1 X X# process command line arguments: X Xfor i in "$@" Xdo X if [ $# -gt 0 ] X then X if [ $# -gt 3 ] X then X ERROR=1 X else X if [ "x$1" = "x-r" ] X then X ITERATIONS=-99 X if [ $# -ge 2 ] X then X shift X if [ "x$1" = "x-s" ] X then X VERBOSE=0 X else X SLEEPTIME=$1 X shift X fi X fi X else X if [ "x$1" = "x-s" ] X then X VERBOSE=0 X shift X else X ERROR=1 X fi X fi X fi X fi Xdone X Xif [ $ERROR -eq 1 ] Xthen X echo " XUsage: $0 [-r []] [-s] [-?|-h] X X -r : run repeatedly, default sleep is 5 seconds X -s : silent -- no headers, procedure counts only X -? or -h : display this message X" X exit Xfi X X# now the work begins Xwhile : Xdo X > /tmp/$$ X X for i in `onstat -g sql | grep PROCEDURE | awk '{print $1}'` X do X for j in `onstat -g sql $i | grep EXECUTE | awk '{print $3}' | cut -d\. -f 2 | cut -d\( -f 1 | sort -u` X do X echo $j >> /tmp/$$ X done X done X X if [ $VERBOSE -eq 1 ] X then X onstat - X echo X echo "Procedure Count" X echo X fi X X for i in `sort -uf /tmp/$$` X do X echo "$i \c" X grep -c $i /tmp/$$ X done > /tmp/s$$ X X if [ $VERBOSE -eq 1 ] X then X awk 'BEGIN { s = 0 } { printf $1; for ( i = length($1) ; i <= 25 ; i++ ) printf " " ; print $2 ; s += $2 } END { print ; printf "Total" ; for ( i = 5 ; i <= 26 - length(s) ; i++ ) printf " " ; print s ; print } ' /tmp/s$$ X else X awk '{ printf $1; for ( i = length($1) ; i <= 25 ; i++ ) printf " " ; print $2 ; s += $2 } ' /tmp/s$$ X fi X X rm /tmp/$$ X rm /tmp/s$$ X X if [ $ITERATIONS -ne -99 ] X then X break X fi X X if [ $SLEEPTIME -gt 0 ] X then X sleep $SLEEPTIME X fi Xdone X X# yibbida-yibbida, that's all folks... SHAR-EOF if [ `wc -c readme.onprocs <<'SHAR-EOF' Xonprocs : a shell script to show you which stored procedures are being executed XWritten by : Obnoxio The Clown XDate: 22 February 2000 XNote: No warranties or guarantees -- use at your own risk! XUsage : onprocs [-r []] X (default interval is 5 seconds) X SHAR-EOF if [ `wc -c