Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

kill user at login

Status
Not open for further replies.

fathead

IS-IT--Management
Joined
Apr 13, 2002
Messages
154
I have a user that continually shuts his computer down without logging out first. This leaves a process running that takes a license from the software...eventually, all the licenses's are taken and the manager has to kill the processes. I want to create a shell script that kills the users processes each time he logs in. Any suggestions???
 
You are going about this the wrong way. Don't fix the symptom, fix the source of the problem. You need to train the user to log out properly.

What I suggest is that you lock the user's account if there is an existing session for them. Forcing them to come to IS to have their old session cleared might just be inconvenient enough to train them to log out like they are supposed to.

Just my two cents worth :)
 
problem is that this company has no IT dept. They contract my company for admin & support. I have trained the users how to logout properly...The manager has to kill the processes and wants me to create a script to do this when they login.
 
who am i|cut -c 1-8 |tee usrfile
usr=`cat usrfile`
ps -u $usr|grep <name of process> |cut -c 1-5|tee testfile
num=`cat testfile`
kill -9 $num

This works...!!!
 
Killing the processes on login will prevent multiple sessions for the same user. Depending on the software, some users may need to have more than one session open at a time, so you need to make sure this won't be a problem before implementing the script.

An alternative way to handle this issue would be kill any open processes in a cron script after hours.
 
how about idleout.....

I usually set this to:

idleout 7:59

so if they are idle for 8 hrs then the system will kill them for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top