slackbuilds_ponce/system/apache-tomcat/rc.tomcat
Andrew Clemons b2519f95fd
various: Use zulu jdk builds for REQUIRES.
As noted in the FAQ, you can still use Oracle's JDK for
building or running, but we'll default to the Zulu builds
in the REQUIRES since they are easily downloadable.

Zulu is a good default for us at SBo since it is available
for both 32 and 64 bit, freely downloadable and compatible
and they provide builds for all the LTS branches.

We don't currently have builds for Adoptium (previously
AdoptOpenJDK, not part of the Eclipse Foundation), but if
someone wants to submit builds for them, we can include them
too. Note though that they do not provide 32 bit builds.

Software should run with either Zulu or Oracle's JDK, or
indeed any other builds of OpenJDK, so if I have broken your
build with this change, apologies. This should be rare and
we can change the REQUIRES back to jdkX in that case and note
it in the README, but I do not expect this should be the case.

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2022-03-03 15:56:51 +07:00

96 lines
2.2 KiB
Bash

#!/bin/sh
# Start/stop/restart apache-tomcat.
# $Id: rc.apache-tomcat,v 1.2.0 2013/11/30
# Authors: Heinz Wiesinger <pprkut@liwjatan.at>, Vincent Batts <vbatts@hashbangbash.com>
# ---------------------------------------------------------------------------
# Load tomcat specific java vm options
. /etc/tomcat/tomcat-java.conf
# Load environment variables
. /etc/profile.d/apache-tomcat.sh
if [ -z "$JAVA_HOME" ]; then
for i in /etc/profile.d/*jdk*.sh; do
if [ -x $i ]; then
source $i
break
fi
done
fi
PIDFILE="/var/spool/tomcat/tomcat.pid"
LOGFILE="/var/log/tomcat/tomcat.log"
CLASSPATH="$CATALINA_BASE/bin/bootstrap.jar:$CATALINA_BASE/bin/tomcat-juli.jar"
CLASSPATH="$CLASSPATH:/usr/share/java/commons-daemon.jar"
for i in $CATALINA_LIBDIR/*.jar; do
CLASSPATH=$CLASSPATH:$i
done
USER="tomcat"
JSVC="/usr/bin/jsvc"
TOMCAT_CMD="-user $USER -cp $CLASSPATH \
-pidfile $PIDFILE -outfile $LOGFILE -errfile $LOGFILE \
-Xms$MEMALLOC_MIN -Xmx$MEMALLOC_MAX -Xss$STACK -XX:MaxPermSize=$MAXPERMSIZE \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
-Dcatalina.home=$CATALINA_HOME -Dcatalina.base=$CATALINA_BASE \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
-Djava.awt.headless=true org.apache.catalina.startup.Bootstrap"
tomcat_start() {
echo -n "Starting Apache Tomcat ... "
if ! [ -e /var/run/tomcat ]; then
mkdir /var/run/tomcat
chown tomcat:tomcat /var/run/tomcat
chmod 755 /var/run/tomcat
fi
if ! [ -e /var/tmp/tomcat ]; then
mkdir /var/tmp/tomcat
chown tomcat:tomcat /var/tmp/tomcat
chmod 755 /var/tmp/tomcat
fi
if [ -e "$PIDFILE" ]; then
echo "already running!"
else
unset DISPLAY
cd /var/lib/tomcat
$JSVC $TOMCAT_CMD
echo "done!"
fi
}
tomcat_stop() {
echo -n "Stopping Apache Tomcat ... "
if [ -e "$PIDFILE" ]; then
cd /var/lib/tomcat
$JSVC -stop $TOMCAT_CMD
echo "done!"
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