LTSP CleanUp User Processes
Server Training - Linux Terminal Server

LTSP Process CleanUp

Bonobo-server-activation is a process connected with the GNOME desktop.  Using a regular computer if this process hangs after a user logs out it is not much of a problem.  But on a Linux Terminal Server this is a disaster.  Here is one example of  a serious problem.  Using the ps command you can see that when a user logs out bonobo-activation does not clean up correctly. The example comes from an Ubuntu machine.  What is worse is that you can see that it consumes both virtual memory (41116) and physical memory (3188).  Multiply this times 150 users and you have a server that must have the processes cleaned up each day manually  in order for it to continue to run.  Every one of these processes has to be killed manually if you want to retrieve your memory.

user  25395  0.0  0.0  41116  3188 ?        Ssl  Feb16   0:00 /usr/lib/bonobo-activation/bonobo-activation-server

There are all kinds of ways to get rid of this, but the way that I found the most effective and the most transparent for the user is to edit each user's .bash_logout script.  The bash_logout script is a script that executes when a user logs out of the system.  This script should be modified and placed in the /etc/skel directory so that if you create new users you do not have to modify their accounts later.

This text was entered into a default .bash_logout and then copied to each user's home directory with a script.

# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

# Kill all processes on Exit
killall -9 bonobo-activation-server
killall -9 gvfs-fuse-daemon

Once you have saved a .bash_logout script and it has been configured correctly, you then can use this script to copy a new .bash_logout to each user you want to update.  Note that the script functions one user at a time and not only copies the file but changes the permissions so it can be executed.

#!/bin.sh
#
echo "Enter a User"
read USER

cp .bash_logout /home/$USER/

chown -R $USER:$USER /home/$USER/