#!/bin/ksh # Program: get_trans # Purpose: This script gathers transaction information and # displays the information to standard output. # Author: Adam Backman # Date Written: 11/06/98 # # Setup the environment SCRIPTS=${SCRIPTS-/u3/users/adamb/scripts} TMP=$SCRIPTS/tmp/trans.tmp export SCRIPTS typeset transid i typeset lasttransid i # Setup database specific variables . $SCRIPTS/live/read_registry $1 case $? in 2) echo "Database $1 is not in database registry" exit 1 ;; 3) echo "Database $1 is on $HOST not on this host" exit 1 ;; esac # Check to see if the database is up or down proutil $DB_DIR/$DB -C busy 2>/dev/null >/dev/null if [ $? -eq 0 ] then echo "The database is not running - No Users" exit 1 else promon $DB_DIR/$DB << $END$ 2>/dev/null |cut -c 1-13,35-50| sort -u -r +2 | head -1 | read usrno usrid transid usrpid 1 1 q q $END$ fi if [ $transid = 0 ] then echo "" echo "No Transactions active for ${DB}" echo "" exit 0 fi promon $DB_DIR/$DB << $END$ 2>/dev/null |grep transaction | cut -f 2 -d : | read lasttransid 7 q q $END$ ps -ef | grep ${usrpid} | grep _progres | read trash1 trash2 trash3 trash4 trash5 usrtty trash7 finger -i | grep ${usrid} | grep ${usrtty} | read trash1 trash2 trash3 trash4 trash5 logintime idletime if [ x${idletime} = "x" ] then idletime="No Idle Time" fi transgap=`expr $lasttransid - $transid` clear echo "" echo "" echo "" echo "Oldest Open Transaction Information" echo "-----------------------------------" echo "User ID ----------->: "$usrid echo "User Number ------->: "$usrno echo "Transaction ID ---->: "$transid echo "Process ID -------->: "$usrpid echo "Idle Time --------->: "$idletime echo "" echo "Transaction Gap --->: "$transgap echo "" echo ""