cee7bee
#!/bin/bash
cee7bee
cee7bee
if [ -r /usr/share/java-utils/java-functions ]; then
cee7bee
  . /usr/share/java-utils/java-functions
cee7bee
else
cee7bee
  echo "Can't read Java functions library, aborting"
cee7bee
  exit 1
cee7bee
fi
cee7bee
cee7bee
_save_function() {
cee7bee
    local ORIG_FUNC=$(declare -f $1)
cee7bee
    local NEWNAME_FUNC="$2${ORIG_FUNC#$1}"
cee7bee
    eval "$NEWNAME_FUNC"
cee7bee
}
cee7bee
cee7bee
run_jsvc(){
cee7bee
    if [ -x /usr/bin/jsvc ]; then
ea624b1
        TOMCAT_USER="${TOMCAT_USER:-tomcat}"
ea624b1
        JSVC="/usr/bin/jsvc"
ea624b1
ea624b1
        JSVC_OPTS="-nodetach -pidfile /var/run/jsvc-tomcat${NAME}.pid -user ${TOMCAT_USER} -outfile ${CATALINA_BASE}/logs/catalina.out -errfile ${CATALINA_BASE}/logs/catalina.out"
ea624b1
        if [ "$1" = "stop" ]; then
ea624b1
            JSVC_OPTS="${JSVC_OPTS} -stop"
cee7bee
    	fi
cee7bee
cee7bee
        exec "${JSVC}" ${JSVC_OPTS} ${FLAGS} -classpath "${CLASSPATH}" ${OPTIONS} "${MAIN_CLASS}" "${@}"
cee7bee
    else
cee7bee
       	echo "Can't find /usr/bin/jsvc executable"
cee7bee
    fi
cee7bee
cee7bee
}
cee7bee
cee7bee
_save_function run run_java
cee7bee
cee7bee
run() {
cee7bee
   if [ "${USE_JSVC}" = "true" ] ; then
cee7bee
	run_jsvc $@
cee7bee
   else
cee7bee
	run_java $@
cee7bee
   fi
cee7bee
}
cee7bee