[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Purge users processes at logout



On Wed, 2005-04-13 at 03:19 -0700, Rob Owens wrote:
> I've noticed the same problem with KDM.  I can't say
> for sure if KDM is better or worse than GDM, but I
> suspect there is no difference.
[SNIP]
> > The problem is that this script only purges
> > processes at logout. I suspect the
> > processes you have trouble with are orphaned
> > processes right?
> > PURGE_PROCESSES=YES calls /usr/sbin/purge_user from
> > /etc/X11/gdm/PostSession/Default.
> > 
> > The real culprit seems to be Gdm that doesnt kill
> > the users processes if they
> > are left orpaned by a locked up client, a user that
> > just [ctrl][alt][backspace]
> > or any other event that just leaves the processes
> > left hanging. Maybe KDM would
> > be a better login manager until GDM gets fixed.
> > 
> > I would love to hear a good solution on this problem
> > myself.

I use a script that was posted on the list to purge all processes at one
minute past midnight. Cut paste from below. And thanks to the original
poster.
-- 
Sudev Barar
Learning Linux

#!/bin/bash
# Kill old leftover processes - all of them
users=$(awk -F":" '{if ( $3 >= 500 ) print $1}' /etc/passwd | grep -v -e
smb -e ^nfs )
for user in $users
        do
        # echo $user
        processes=$(ps -ef | grep ^"$user " | grep -e Jan[0-9] -e Feb
[0-9] -e Mar[0-9] -e Apr[0-9] -e May[0-9] -e Jun[0-9] -e Jul[0-9] -e Aug
[0-9] -e Sep[0-9] -e Oct[0-9] -e Nov[0-9] -e Dec[0-9] | awk '{print
$2}')

        for process in $processes
                do
                kill -9 $process
                done
        done



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]