On Wed, 2006-08-09 at 11:11 +0530, Jigish Gohil wrote:
On 8/8/06, James D. Parra <Jamesp@musicreports.com> wrote:
Hello,
Short of rebooting, how to close an open session of a user who is logged in?
Here is what we use on one of our LTSP servers. It's not a good way to do it, there must be better way to logoff users than killing all the processes belonging to that user.
Linux being multisuser system, there must be simpler way of doing this if there already isnt. Till then this one works
-J
#!/bin/bash echo -n "enter username to log out:" read user ps U $user | cut -d "?" -f 1 > /tmp/killuser.txt find /tmp -user $user ? /tmp/usertmpfiles.txt cat /tmp/killuser.txt | \ while read pid do kill -9 $pid
Not good. Use "kill -1" first and then "kill -9" if there are still processes left running. Using kill -9 will no doubt leave you with an unstable system sooner then later. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998