#!/bin/ksh
#
#*******************************************************************************
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#*******************************************************************************
#

#
## WARNING: This file must not be altered in any way.
##          Please consult your Kiosk Session Service documentation for details
##          on building your own Kiosk Sessions.
#

theModule=kiosk:jds3-session:logout

#
## Main
#

logger -i -p user.debug -t $theModule "Starting jds3-session"

#
## Load utilities and setup basic Kiosk Environment
#
theUtilsFile=/opt/SUNWkio/lib/utils.sh
if [ ! -r $theUtilsFile ] ; then
 logger -i -p user.error -t $theModule \
        "Error: can't read Kiosk utils file '$theUtilsFile'"
 exit 1
else
 . $theUtilsFile
 if [ $? -ne 0 ] ; then
  logger -i -p user.error -t $theModule \
         "Error: failed to load Kiosk utils file '$theUtilsFile'"
  exit 1
 fi
fi

theOpts="-TERM"
theUser=`/usr/xpg4/bin/id -u`
if [ -z "$theUser" ] ; then 
 logWarning -m $theModule -l "Warning: couldn't retrieve user id"
else
 theOpts="$theOpts -u $theUser"
fi

pkill $theOpts gnome-session
if [ $? -ne 0 ] ; then
 logError -m $theModule -l "Error: failed to kill gnome-session"
fi
