#!/bin/sh
#
# Wrapper script for jasper 4.0, to be sure it will allways
# be run with correct user profile (nobody by default)
#
# derived from stuff in tomcat4.init
#
# Gomez Henri <hgomez@slib.fr>
# Keith Irwin <keith_irwin@non.hp.com>
# Nicolas Mailhot <nicolas.mailhot@one2team.com>
#

# Get Tomcat config

TOMCAT_CFG="/etc/tomcat4/tomcat4.conf"

[ -r "$TOMCAT_CFG" ] && . "${TOMCAT_CFG}"

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/djasper4

# Tomcat name :)
TOMCAT_PROG=jasper4
        
# if TOMCAT_USER is not set, use nobody like Apache HTTP server
if [ -z "$TOMCAT_USER" ]; then
    TOMCAT_USER="nobody"
fi

# Since the daemon function will sandbox $tomcat
# no environment stuff should be defined here anymore.
# Please use the /etc/tomcat4/tomcat4.conf file instead ; it will
# be read by the $tomcat script

RETVAL=0

su - $TOMCAT_USER -c "$TOMCAT_SCRIPT $@"
RETVAL=$?
exit $RETVAL
