We really need to revisit this spec for Hardy Heron

David Trask dtrask at vcsvikings.org
Sun Sep 2 20:00:31 BST 2007


Would it be possible to do it more by user....rather than by specific
processes?  In other words....all processes left behind by the user
logging in are killed?  This is just an idea....I have no idea if it
works....culled from the purge_users script....

#!/bin/bash

KILL=/usr/bin/pkill


# define the minimum uid
if [ -f /etc/login.defs ]
then
      UID_MIN="`grep UID_MIN /etc/login.defs | awk '{print $2}'`"
fi
if [ ! $UID_MIN ]
then
     UID_MIN=500
fi



# make sure the pkill command exists
if [ ! -x $KILL ]
then
     echo
     echo "ERROR: $KILL not found, aborting"
     echo
     exit
fi

# only work on UIDs greater than 500 (or whatever UID_MIN is set to)
UIDNUMBER=`id -u $1 2> /dev/null`
if [ ! "$UIDNUMBER" ]
then
     echo
     echo "ERROR: could not determine the user's UID number, aborting"
     echo
     
fi
if [ "$UIDNUMBER" -lt $UID_MIN ]
then
     echo
     echo "ERROR: user's UID number ($UIDNUMBER) is less than $UID_MIN,
aborting"
     echo
     
fi

# okay, everything checks out. Let's do the dirty work

# first do it nicely
$KILL -u $1

# wait a couple seconds
sleep 2s

# now do it the hard way
$KILL -9 -u $1

Scott Balneaves <sbalneav at legalaid.mb.ca> writes:
>On Sun, Sep 02, 2007 at 11:43:00AM -0400, David Trask wrote:
>
>> >pkill tuxpaint.
>>   Doh!  killall tuxpaint didn't work....
>
>pkill -9?
>
>> The issue is....kid does somethign stupid and quits mid-session....turns
>> terminal off...program freezes...etc.   Then when they log back in
>> again....the system still has that lingering process(es) from the
>previous
>> session.  Mozilla used to be a big problem in the old days....nowadays
>> Firefox can cause issues.  It still sees the default profile as still
>> being in use.  The purge users script is essentially set up to purge the
>> old processes as the user logs in.  Do you think this is something that
>> could be done "PreSession"?  Something along the lines of....whoever is
>> logging in "now"....kill off all previous processes associated with
>them. 
>> I believe Eric did it with pkill.  Any ideas on how I can run something
>> like this early enough in the logon process without killing the current
>> session?
>
>https://wiki.ubuntu.com/LDMrcScripts
>
>place in /opt/ltsp/i386/usr/share/ldm/rc.d/S10cleaner
>
>Off the top of my head (not tested)
>
>#
># Session script to clean up previous session
># WARNING!  WILL KILL ANY CONCURRENT USER LOGINS
>#
>
>PROCSTOKILL="Xsession gconfd firfox tuxpaint etc etc"
>
>for PROC in ${PROCSTOKILL}; do
>    ssh -S ${LDM_SOCKET} ${LDM_SERVER} "pkill -9 ${PROC}"
>done
>
>Scott
>
>-- 
>Scott L. Balneaves | "Eternity is a very long time,
>Systems Department |  especially towards the end."
>Legal Aid Manitoba |    -- Woody Allen
>
>-- 
>edubuntu-users mailing list
>edubuntu-users at lists.ubuntu.com
>Modify settings or unsubscribe at:
>https://lists.ubuntu.com/mailman/listinfo/edubuntu-users



David N. Trask
Technology Teacher/Director
Vassalboro Community School
dtrask at vcsvikings.org
(207)923-3100





More information about the edubuntu-users mailing list