Hello,

whole script.
It kills processes of logged-out users.
On our system it runs every few minutes and works efficient enough.
Maybe not the best solution, but works for us :] We do not allow users 
to run own demonized processes.
We use lt...@hardy (ubuntu repo package).


Greetings,

Wojtek


# begin of script
#!/bin/bash


# List users with processes
ps -eo user --no-headers | sort | uniq > procUsers
# List logged-in users
who | awk '{print $1}'| sort | uniq > loginUsers


sdiff -s loginUsers procUsers | awk '{print $2}' > procNoLoginUsers

while read -r USER
do
         tempUID=`id -u $USER`

         # ndbroot process
         if [ $tempUID -eq 65534 ]
         then
                 tempUID=100;
         fi
         # Processes of users UID >= 1000
         if [ $tempUID -ge 1000 ]
         then
                 # SIGTERM
                 killall -u $USER -s 15
                 sleep 2
                 # SIGKILL
                 killall -u $USER -s 9

         fi

done < procNoLoginUsers


rm procUsers
rm loginUsers
rm procNoLoginUsers
# end of script

Keith wrote:
> Hi there LTSPers,
> 
> We run an ubuntu 8.10 / LTSP 5.0 classroom at our school.
> We have a quad-core server with 8G RAM and 26 clients.
> Gigabyte switches.
> So, on paper, it should cope with ease
> 
> When the classes logout hundreds of processes are left open.
> So by trial and error I have come up with the following script (very 
> simplistic and elementary but what the heck, it works!!)
> When I check htop: the 4 processors are down to nearly zero (0,6%, 0,6%, 0% 
> and 0%) and the Mem is down to around 350/8094. Nice and clean.
> 
> If anyone has a more efficient method let me know!
> Cheers,
> Keith
> 
> I have called it proc-cleanup and . /proc-cleanup does the trick!!
> ---------------------------------------------------------------
> # Cleaning up procs that are causing trouble
> killall -9 x-session-manager
> killall -9 update-notifier
> killall -9 evolution-data-server-2.24
> killall -9 bonobo-activation-server
> killall -9 gvfsd-trash
> killall -9 ica
> killall -9 gvfsd
> killall -9 klauncher
> killall -9 kded4
> killall -9 gvfsd-burn
> killall -9 evolution-data-server-1.12
> killall -9 gnome-panel
> killall -9 kbounce
> killall -9 knotify4
> killall -9 gnome-screensaver
> killall -9 gnome-settings-daemon
> killall -9 gnome-power-manager
> killall -9 nautilus
> killall -9 kded
> killall -9 dbus-launch
> killall -9 hald-addon
> killall -9 hald
> killall -9 dcopserver
> killall -9 python
> killall -9 firefox
> killall -9 tuxpaint
> killall -9 tuxmath
> killall -9 metacity
> killall -u nobody
> killall -u haldaemon
> killall -9 dbus-daemon
> /etc/init.d/dbus stop
> /etc/init.d/dbus start
> killall -9 console-kit-daemon
> ----------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _____________________________________________________________________
> Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
>       https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
> For additional LTSP help,   try #ltsp channel on irc.freenode.net
> 


-- 
Wojtek Polcwiartek

------
tubIT
TU-Berlin
Web   : www.tubit.tu-berlin.de
Email : [email protected]
Tel   : +49.30.314.28000

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to