2010-05-13 02:20:34 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# Start/stop/restart apache-tomcat.
|
2011-04-01 23:29:26 +02:00
|
|
|
# $Id: rc.apache-tomcat,v 1.1.4 2011/04/01
|
2010-05-13 02:20:34 +02:00
|
|
|
# Authors: Heinz Wiesinger <pprkut@liwjatan.at>, Vincent Batts <vbatts@hashbangbash.com>
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Load tomcat specific java vm options
|
|
|
|
. /etc/tomcat/tomcat-java.conf
|
|
|
|
|
|
|
|
PIDFILE="/var/spool/tomcat/tomcat.pid"
|
|
|
|
LOGFILE="/var/log/tomcat/tomcat.log"
|
|
|
|
|
|
|
|
CLASSPATH="/usr/share/tomcat/bin/bootstrap.jar:/usr/share/java/commons-daemon.jar"
|
|
|
|
for i in /usr/share/tomcat/lib/*.jar; do
|
|
|
|
CLASSPATH=$CLASSPATH:$i
|
|
|
|
done
|
|
|
|
|
|
|
|
USER="tomcat"
|
|
|
|
|
|
|
|
TOMCAT_CMD="/usr/bin/jsvc -user $USER -cp $CLASSPATH \
|
|
|
|
-pidfile $PIDFILE -outfile $LOGFILE -errfile $LOGFILE \
|
|
|
|
-Xms$MEMALLOC_MIN -Xmx$MEMALLOC_MAX -Xss$STACK -XX:MaxPermSize=$MAXPERMSIZE \
|
|
|
|
-Djava.awt.headless=true org.apache.catalina.startup.Bootstrap"
|
|
|
|
|
|
|
|
tomcat_start() {
|
|
|
|
echo -n "Starting Apache Tomcat ... "
|
|
|
|
if [ -e "$PIDFILE" ]; then
|
|
|
|
echo "already running!"
|
|
|
|
else
|
2011-04-01 23:29:26 +02:00
|
|
|
unset DISPLAY
|
2010-05-13 02:20:34 +02:00
|
|
|
cd /var/lib/tomcat
|
|
|
|
$TOMCAT_CMD
|
|
|
|
echo "done!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
tomcat_stop() {
|
|
|
|
echo -n "Stopping Apache Tomcat ... "
|
|
|
|
if [ -e "$PIDFILE" ]; then
|
|
|
|
kill -TERM $(cat $PIDFILE) > /dev/null 2>&1
|
|
|
|
echo "done!"
|
|
|
|
rm -f "$PIDFILE"
|
|
|
|
else
|
|
|
|
echo "not running!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Restart tomcat:
|
|
|
|
tomcat_restart() {
|
|
|
|
tomcat_stop
|
|
|
|
sleep 1
|
|
|
|
tomcat_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
tomcat_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
tomcat_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
tomcat_restart
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage $0 start|stop|restart"
|
|
|
|
esac
|