View Single Post
  #1  
Old 6th May 2002, 20:44
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,032
NPRao will become famous soon enough
Baan: iBaanERP-5.2a(Reger),SSA-ERP-LN-6.1,Infor LN-10.x - DB: Oracle-10g,11g,12c,MS-SQL - OS: HP-UX, Linux, Windows
Pat gave me this idea to make a shell script to get the output in a formatted way... hope everyone finds it useful...

I found that it does take some execution time so have patience!

I hope I am ok with this copyright documentation stuff for the coding...

Code:
#*************************************************
# Platform : UNIX 
# Copyright 2002 - by N. Prashanth Rao
# All Rights Reserved 
# Permission to use, copy, modify, and distribute this software 
# and its documentation for any purpose and without fee is 
# hereby granted, provided that the above copyright notice 
# appear in all copies and that both that copyright notice and this
# permission notice appear in supporting documentation.  
# N. Prashanth Rao and Baanboard.com DISCLAIM ALL 
# WARRANTIES WITH REGARD TO THIS  SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 
# FITNESS, IN NO EVENT SHALL N. Prashanth Rao nor 
# Baanboard.com BE LIABLE FOR ANY  SPECIAL, INDIRECT OR 
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES  WHATSOEVER 
# RESULTING FROM LOSS OF USE, DATA OR PROFITS,  WHETHER 
# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER  
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 
# THE USE  OR PERFORMANCE OF THIS SOFTWARE. 
#************************************************* 

# Shell script to verify if a user is executing a particular session
# Author: N. Prashanth Rao

clear
if test $# -ne 1
then
        echo "Command Usage: $0 Session-code"
        exit
fi
for i in `ps -ef | grep bshell | grep -v "grep bshell"|awk '{print $2}'`
do
        bshcmd6.2 -s -p -u5 -w5 $i | grep $1 > /dev/null
        if test $? -eq 0
        then
                userid=`ps -ef | grep $i | cut -f1 -d" " | uniq`
                echo "Session " $1 "in use by " $userid
        fi
done
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao

Last edited by ~Vamsi : 9th June 2002 at 19:18.
Reply With Quote