0797b1
#!/bin/bash
0797b1
0797b1
if [ -r /usr/share/java-utils/java-functions ]; then
0797b1
  . /usr/share/java-utils/java-functions
0797b1
else
0797b1
  echo "Can't read Java functions library, aborting"
0797b1
  exit 1
0797b1
fi
0797b1
0797b1
_save_function() {
0797b1
    local ORIG_FUNC=$(declare -f $1)
0797b1
    local NEWNAME_FUNC="$2${ORIG_FUNC#$1}"
0797b1
    eval "$NEWNAME_FUNC"
0797b1
}
0797b1
0797b1
run_jsvc(){
0797b1
    if [ -x /usr/bin/jsvc ]; then
0797b1
        TOMCAT_USER="${TOMCAT_USER:-tomcat}"
0797b1
        JSVC="/usr/bin/jsvc"
0797b1
0797b1
        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"
0797b1
        if [ "$1" = "stop" ]; then
0797b1
            JSVC_OPTS="${JSVC_OPTS} -stop"
0797b1
    	fi
0797b1
0797b1
        exec "${JSVC}" ${JSVC_OPTS} ${FLAGS} -classpath "${CLASSPATH}" ${OPTIONS} "${MAIN_CLASS}" "${@}"
0797b1
    else
0797b1
       	echo "Can't find /usr/bin/jsvc executable"
0797b1
    fi
0797b1
0797b1
}
0797b1
0797b1
_save_function run run_java
0797b1
0797b1
run() {
0797b1
   if [ "${USE_JSVC}" = "true" ] ; then
0797b1
	run_jsvc $@
0797b1
   else
0797b1
	run_java $@
0797b1
   fi
0797b1
}
0797b1