adjustment to lock.info part 2

Richard D. Williams richard at appgrp.net
Sat Feb 25 09:56:14 PST 2012


While I was fooling around with this script I made a few changes I think 
some will like.

    # Get the user names, ttys and commands being executed:
*clear
$ECHO "
Filepro File    Record   User     TTY      PID   Idle     IP"
*
    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}'`;
USER_IDLE=`w | grep pts/0 | awk '{print $5}'`;
USER_IP=`w | grep pts/0 | awk '{print $3}'`;
$ECHO "$PFNAME         ${REC_NUM[i]}   $USER_NEW $TTY        ${PID[i]} 
$USER_IDLE    $USER_IP";
**#original code commented out*
       #$ECHO "
    #filePro File: $PFNAME
   #Record Number: ${REC_NUM[i]}
            #User: $USER_NEW Idle: $USER_IDLE IP: $USER_IP
             #TTY: $TTY
             #PID: ${PID[i]}
         #Command: $CMD";/usr/local/bin/pause
      [[ $PROMPT = 1 ]] && PE
   done
done

This is what these changes will yield:

Filepro File    Record   User     TTY      PID   Idle     IP
wip_web         853204   dbrinkev ?        24385 3days    user-387o84p.cab

Press Enter to continue:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20120225/896b7fa0/attachment.html 


More information about the Filepro-list mailing list