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