return to PRS Technologies website


watch_session.sh
#!/usr/bin/ksh ############################################################################### # # Module: watch_session.sh # Author: Peter R. Schmidt # Description: Monitor progress of a single Informix 4ge session # # Change Log # # Date Name Description................. # 05/13/02 Peter R. Schmidt Start Program # ############################################################################### echo "Watch an single informix 4ge session..." echo ps -ef | grep COMMAND | grep -v grep ps -ef | grep "\.4ge" | grep -v grep | cut -c1-80 echo echo "Enter Unix Process ID (PID)" read PSID echo onstat -g ses | egrep "session|id" onstat -g ses | grep $PSID echo echo "Enter Informix session ID" read SESSION echo echo "Watch SQL also (y/n) ?" read SQL_OPTION echo while true do onstat -u | grep address onstat -u | grep $SESSION if [ $SQL_OPTION = Y -o $SQL_OPTION = y ]; then onstat -g sql $SESSION | tail +7 | awk '/Current SQL statement :|Last parsed SQL statement :/ { flag=1 } { if ( flag==1 ) print $0 }' fi echo "----------------------------------------------------------------------" sleep 5 done ################################################################################