small adjustment to lock.info
Richard D. Williams
richard at appgrp.net
Sat Feb 25 09:51:51 PST 2012
When I ran "H - Bob Stockler's lockinfo script", it was giving me
filepro as the user who had a record locked.
By making the following change, I got the actual user name on the TTY.
snipet:
# Get the user names, ttys and commands being executed:
for i in $I
do # Get user name, tty & command for the process holding the lock:
eval $( $PS -ef |
$AWK -v PID="${PID[i]}" '
$2 == PID { print "USER=" $1 ; print "TTY=" $6
$1 = $2 = $3 = $4 = $5 = $6 = $7 = "" ; sub(/^[
\t]+/,"")
print "CMD=\"" $0 "\"" }' )
# Print the results:
*USER_NEW=`w | grep pts/0 | awk '{print $1}'`*
$ECHO "
filePro File: $PFNAME
Record Number: ${REC_NUM[i]}
User: *$USER_NEW*
TTY: $TTY
PID: ${PID[i]}
Command: $CMD"
[[ $PROMPT = 1 ]] && PE
The use of ps -ef does not give the actual user.
i.e.
filepro 7175 7172 0 11:01 pts/0 00:00:00 /appl/fp/dclerk
But if you use w and grep for the tty you get the actual user.
i.e.
richard pts/0 99-101-38-43.lig 10:42 24:25 0.17s 0.00s
/appl/fp/runmenu
Also, you could add:
idle time for that user:*USER_IDLE=`w | grep pts/0 | awk '{print $5}'`*
user's ip connect : *USER_IP=`w | grep pts/0 | awk '{print $3}'`*
Then insert, User Idle: $USER_IDLE and $USER_IP, just below User: $USER_NEW
I hope this is helpful,
Richard D. Williams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20120225/c174f89c/attachment.html
More information about the Filepro-list
mailing list