script for killing idle users


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for killing idle users
# 1  
Old 12-14-2005
script for killing idle users

I need a script that will look for idle users and kill there proc.
# 2  
Old 12-14-2005
And what code have you written so far in attempting to solve this problem?
# 3  
Old 12-16-2005
You're lucky I'm bored!

Hers something I whipped up in a few minutes, suggestions?

#!/bin/bash
# kill off users idle for 1 or more days
# 12/16/2005 - kefx

IUSERS=`w | awk '/[1-9]day?/ {print $1}'`

for i in $IUSERS
do
pkill -U $i
done

exit 0
# 4  
Old 12-16-2005
actually --- your script only kills user logins that are longer than 1 day --- it does not differentiate between users who are actively working and users who are are not actively working
# 5  
Old 12-16-2005
Quote:
Originally Posted by Just Ice
actually --- your script only kills user logins that are longer than 1 day --- it does not differentiate between users who are actively working and users who are are not actively working
Can't say I undestand what you mean. If they were actively working they would not have an IDLE listing over 1day or more under 'w'. To my knowledge...
# 6  
Old 12-16-2005
see this ...

if a user has been logged in for over a day and had just finished running a long script and then took a minute to read some notes for the next script --- your script will kill his login when it runs because it does not see when he last did anything on the server

Last edited by Just Ice; 12-17-2005 at 12:42 PM..
# 7  
Old 12-16-2005
Quote:
Originally Posted by Just Ice
see this ...

if a user has been logged in for over a day and had just finished running a long script and then took a minute to read some notes for the next script --- your script will kill his login when it runs because it does not see when he/she last did anything on the server
Yeah, I see what you mean.
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. Shell Programming and Scripting

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"); ... (2 Replies)
Discussion started by: PapaBear
2 Replies

4. 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

5. 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

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