script for cleaning up zombie user processes at the end of the day?
john
lists.john at gmail.com
Thu Jan 18 23:14:23 GMT 2007
Thanks Clay. I appreciate the script. I am going to try this out. But before
I do, I hope you can help me to understand what is going on a little better?
Anyone who feels like chiming in would be quite welcome.
1) basically I think this script is looping through the password db by
calling the program 'getent' and piping the results to awk.
2) Awk is applying a separator : and then something magical happens (what is
$3?) Somehow uids are getting assigned to this variable?
3 Then somehow (related to $3) we look for uids above 999 and pass them to
$1 which will print them to standard output (i.e the tty from which this
script is executed, if executed by hand). Is there more going on here?
4) then the script echos the result of the variable $user and runs 'pgrep
-u' against the expanded variable $user for any gnome-panel and bobono
processes owned by that user
5) the program loops until done.
Sorry, I just like to understand what I am doing before I do it. Will
killing zombie type gnome-panel and bonobo stuff, clean up leftover
processes like firefox, games etc?
TIA!
John
On 1/18/07, Clay Berlo <clay.berlo at dsbn.edu.on.ca> wrote:
>
> Funny, I just ran into the same kind of problem myself not so long ago.
> Talked to they guys on IRC and was given the following:
>
> for user in $(getent passwd | awk -F: '$3 > 999 {print $1}'); do echo
> $user; pgrep -u ${user} gnome-panel || pkill -u ${user} bonobo; done
>
> Now, my system is running the "usual" gnome stuff, so this works for
> killing off processes from anyone not logged in. If you're using KDE or
> XFCE, you'll have to scan for something other thant gnome-panel.
>
> Oliver Grawert has suggested this should go into the ldm script somehow.
> As I'm not familiar with how to play around with that file, I just stuck in
> a cron job to run hourly.
>
> On Wed, 2007-17-01 at 14:30 -0800, john wrote:
>
> Hello all,
>
> I'm running ltsp 4.2 on Ubuntu LTS 6.06 using win2k3 AD for auth. I find
> that at the end of the day I have a lot of leftover student user processes
> running, and I'd like to have a little script that kills them all after
> school. Does anyone have something ready-made or do I need to brew one
> myself?
>
> TIA!
>
> John
>
> --
> Clay Berlo <clay.berlo at dsbn.edu.on.ca>
> DSBN Technical Services
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/edubuntu-users/attachments/20070118/0e9e4b50/attachment-0001.htm
More information about the edubuntu-users
mailing list