Here is the site for Dave Roth and his sys admin via Perl:

        http://www.roth.net/

Wags ;)

-----Original Message-----
From: Akens, Anthony [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 10:14
To: [EMAIL PROTECTED]
Subject: RE: Killing Idle Users


Here's the shell script, for those interested.  Sorry for the
lack of comments, but it's not to hard to figure out with a
little patience...

-----------
PTS=`w -l | grep pts | cut -c10-15`
echo "" >> /home/danb/killemresults
RIGHTNOWDATE=`date`
echo $RIGHTNOWDATE >> /home/danb/killemresults
echo "Starting" >> /home/danb/killemresults
for i in $PTS
do
        #echo $i >> /home/danb/killemresults
        MINUTES=`w -l | grep -w $i | cut -c38-39` 
        for j in $MINUTES
        do
                if (($j > 40))  
                then
                    PID=`ps -e | grep -w $i' ' | cut -c2-6`
                    USERNAME=`w -l | grep -w $i` 
                    echo $USERNAME >> /home/danb/killemresults
                    echo 'killing process id ' $PID ' on ' $i ' because
minutes equal ' $MINUTES >> /home/danb/killemresults
                kill -9 $PID 
                fi
        done
        MINUTES=`w -l | grep -w $i | cut -c37`
        for j in $MINUTES
        do
                if [ "$j" = ":" ] 
                then
                    PID=`ps -e | grep -w $i' ' | cut -c2-6`
                    USERNAME=`w -l | grep -w $i`
                    echo $USERNAME >> /home/danb/killemresults
                    echo 'killing process id ' $PID ' on ' $i ' because
minutes greater than 60 ' $MINUTES >> /home/danb/killemresults
                   kill -9 $PID
                fi    
        done
done

-------------

-----Original Message-----
From: [EMAIL PROTECTED] 
Sent: Tuesday, June 11, 2002 12:15 PM
To: Akens, Anthony; [EMAIL PROTECTED]
Subject: RE: Killing Idle Users


I am not in a position to offer advice but would love to see it .




-----Original Message-----
From: Akens, Anthony [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: Killing Idle Users


Hello,
I'm a sys-admin on an AIX (4.3) machine, and I'm trying to work 
with a vendor program that doesn't behave very nicely.  Basically,
if a user's connection to the server is inappropriately severed
the application keeps right on chugging, leaving the user 
logged in.  By inappropriately severed I mean if our link to the
site the user is at goes down, which happens more often then 
I'd like, but that's a different problem.

Anyway, back to the question...
There are quite a few problems with these unconnected sessions 
being stuck out there, not least of which is that they eat up a 
user license, which are pretty limited in amount.  One good power 
outage or link failure at can make it so we're out of licenses.
In that event the vendor says "Kill them by hand, do NOT automate 
the process" which is all fine and good except that we have 
several hundred users.  That's a lot of time.

The first thought was to use a shell idle logout time, but the
program doesn't respond to the request and remains logged in.

The previous administrator had made a shell script to check idle 
times and automatically log out the users, however since I've 
taken over the box the uptimes have been far greater (I don't 
believe in the same "reboot often" premise that he did) and now 
his script has shown a severe weakness: It's not written to 
handle longer PIDs.

Rather then trying to fix his shell script, which is rather 
convoluted, I thought it would be a perfect candidate for perl, 
which I am just learning.  If I post the script, can I get some 
pointers on re-writing it?  Thanks for your time

Tony Akens
[EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to