Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > c112d1b957b4eb049db50ffbdfdedcf6 > files > 6

pam_script-0.1.12-1mdv2009.1.i586.rpm

#!/bin/sh

# To use this script, rename it to onsessionclose and put it in /etc/security.
# Then edit the OFFENDERS line below and insert all processes that just won't
# die when their users log out, seperated by a "|".

OFFENDERS="kdeinit|artsd"
KILL="kill"
SIGS="TERM HUP KILL"
EGREP=/bin/egrep
AWK=/usr/bin/awk
XARGS=/usr/bin/xargs
LOGGER=/usr/bin/logger

if [ "x$1" != "x" ]; then
	$LOGGER "Killing $OFFENDERS for $1"
	for sig in $SIGS; do
		sleep 2
		ps --no-headers -u $1 -U $1 -o pid,cmd | $EGREP "$OFFENDERS" | $EGREP -v egrep | $AWK '{print $1}' | $XARGS $KILL -$sig
	done
fi