#!/bin/sh
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: mysql
# Required-Stop:
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop Apache Tomcat Servlet container
# Description: Apache Tomcat
### END INIT INFO

JAVA_HOME="/usr/local/java"
JRE_HOME="$JAVA_HOME"
CATALINA_TMPDIR="/work/hosts/temp"
CATALINA_PID="/var/run/tomcat.pid"

CATALINA_OPTS="$CATALINA_OPTS
 -Xmx1024m
 -Dg.PRO.debug=0
 -Dg.PRO.mask=1
 -Dfile.encoding=UTF-8
 -Djava.io.tmpdir=/work/hosts/temp
 -Djava.awt.headless=true"

export JAVA_HOME
export JRE_HOME
export JAVA_OPTS
export CATALINA_OPTS
export CATALINA_TMPDIR
export CATALINA_PID

case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
