Killing idle users TIA


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Killing idle users TIA
# 1  
Old 01-14-2008
PHP Killing idle users TIA

I wrote a script to kill users idle more than 1/2 hour, ignoring those in an exception list. Here is the script as it is now:

#! /usr/bin/awk -f

BEGIN {
system("who -u | sort +5 > /tmp/loginfile");
system("echo User Sessions Killed > /tmp/killedlogins");
system("echo `date` >> /tmp/killedlogins");
while (getline < "/tmp/loginfile") {
split($6,timearray,":");
if (((timearray[1] == "old") || (timearray[1] >= 1) || (timearray[2] >= 30)) &&
($1 != "Exclusion1") &&
($1 != "Exclusion2") &&
($1 != "Exclusion3") &&
($1 != "Exclusion4")) { {
system("kill -9 " $7);
print $1, "[Idle " $6 "] Session terminated from " $8 >> "/tmp/killedlogins";
};
};
system("rm /tmp/loginfile");
system("chmod 644 /tmp/killedlogins");
}

This works fine until one of the excluded users is idle until they become "old". How can I change this so that it still terminates users after 30 minutes and still ignores people on the exclusion list but only until they become "old" and then terminate them too?


Thanks
# 2  
Old 01-14-2008
UNIX IN THE ENTERPRISE - Killing Idle Logins with idled

Idled is far from perfect but it would make your life easier than this.

HTH.
# 3  
Old 01-14-2008
I'll check it out. Thanks for the quick response.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Kill idle script is killing unnecessarly

Hi All,I have a problem with my kill idle script.my script is supposed to kill the user sessions which are idle for more than 2 hours.But is is killing the sessions which are idle for less than 2 hrs also.I dont know the exact time after which the script is killing,but it is less than 2 hours i am... (3 Replies)
Discussion started by: prabhu_kumar
3 Replies

2. HP-UX

kill idle users

Hi, In my network we uses the NetTerm program to connect us to HP-UX 10.x server from windows workstations, but in some cases the user doesn't logout and close it by window's x button. The problem is that in HP-UX the user and all his tasks remain active and when he enter again HP-UX creates a... (12 Replies)
Discussion started by: efrenba
12 Replies

3. UNIX for Advanced & Expert Users

HP-UX users get logged off while idle.

Im "supporting" at least 2500 HP-UX workstations with CAD-related software with the B.11.11 build. I cant say anymore than that because of my companys sligtly paranoid security policy . The last few days a new problem has arised from nowhere. The problem is that users gets logged off when the... (5 Replies)
Discussion started by: Laoinjo
5 Replies

4. Shell Programming and Scripting

Idle users over 1 day

Please help, im modifing an idle script to capture (not kill) users who havee been idle over a time. now i've got to work with the exection of users whos idle time gove over 24 hrs and becomes "old". please advice on how to correct... #Clear old report, generate new data and new report echo "\n... (1 Reply)
Discussion started by: pbonilla
1 Replies

5. Shell Programming and Scripting

script for killing idle users

I need a script that will look for idle users and kill there proc. (7 Replies)
Discussion started by: jdel80
7 Replies

6. Shell Programming and Scripting

finding idle users

I am trying to write a script that will list the idle users on my system which is running HPUX 11.11. The script is currently written as : who -u > /home/rfm/scripts/user.txt echo " There are currently... " wc -l /home/rfm/scripts/user.txt echo " User logins on System : `uname -n` ... (3 Replies)
Discussion started by: rfmurphy_6
3 Replies

7. AIX

Log off idle users

How to set a timer for log out users that have been idle for a long time? It is a AIX 5L (0 Replies)
Discussion started by: wtofu
0 Replies

8. HP-UX

Is there a script available to kill Idle users

My max user parm is set to 1050. I'm currently at 1038 this is causing major slow downs on the server. I looking for a way log off "idle" user logins with out having to do it individually. :confused: (5 Replies)
Discussion started by: rfmurphy_6
5 Replies

9. UNIX for Dummies Questions & Answers

Killing idle user processes

I'm looking for some help, please! I'm trying to kill any idle user processes over 40 Minutes. I have tried putting TMOUT=2400 within the users .profile However this does not seem to be working. We run aix 4.3.3 with ORACLE 7.3 The above works o.k. when the user is only within the... (3 Replies)
Discussion started by: annette
3 Replies

10. Cybersecurity

Killing Idle session

does any one know how to kill an idle session? I want to kill any idle sessions after 30 min... Local or remote.... i want to do this without a script or TCP wrappers...i want to know if there is a file that i can configure..... ThAnks:rolleyes: (4 Replies)
Discussion started by: securhack
4 Replies
Login or Register to Ask a Question