#! /bin/sh
# Xreset - run as root after session exits

# Reassign ownership of the console to root, this should disallow
# assignment of console output to any random users's xterm. See Xstartup.
#
#chown root /dev/console
#chmod 622 /dev/console

#exec sessreg -d -l $DISPLAY -h "`echo $DISPLAY | cut -d: -f1`" $USER

if [ `w -h $USER | wc -l` -lt 1 ] ; then
    esd_id=`ps axuw | grep esd | grep $USER | grep -v grep | gawk '{print $2}' `
    if [ "$esd_id.x" != ".x" ]; then
        kill $esd_id
    fi
fi

