That looks OK, but I would suggest the following.
Put all the real stuff in a standard bash script with 3 parameters start,
stop, restart- pretty much like the OLD system 5 way fo doing things.This has
the advantage of allowing you to add other things you might want to add AND
executing the script as root is pretty obvious. (I needed to add starting an
LibreOffice server and a few other daemons to get that going). Embed the
catalina start stop in that script.The just make the systemd script VERY SIMPLY
call your standard above start/stop script.
e.g. my script name is S95tomcat and the systemd entry is trivial.
here is tomcat.service:
[Unit]
Description=The Jakarta Apache/Tomcat Server
After=network.target
[Service]
Type=forking
ExecStart=/local/bin/S95tomcat start
ExecReload=/local/bin/S95tomcat restart
ExecStop=/local/bin/S95tomcat stop
[Install]
WantedBy=multi-user.target
On Thursday, June 4, 2015 9:31 PM, Dale Ogilvie <[email protected]>
wrote:
Hi all,
I am trying to put together a systemd script for an install of the current
binary release tomcat7. Follows my current best effort, cobbled together from
the (RH)EL7 packaged version and some googling... I am trying to use the
unadulterated tomcat up/down scripts from the binary release.
Any suggestions as to how this might be improved? I'm not sure if I am using
the right service type here, based on what catalina.sh is doing under the hood.
That said, it seems to work.
Thanks
Dale
**** follows apache-tomcat.service
# Systemd unit file for apache-tomcat
#
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/apache-tomcat/apache-tomcat.pid
ExecStart=/opt/apache-tomcat/bin/startup.sh
ExecStop=/opt/apache-tomcat/bin/shutdown.sh
SuccessExitStatus=0
User=apache-tomcat
Group=apache-tomcat
[Install]
WantedBy=multi-user.target
***** follows setenv.sh commented out sections removed
# Where your java installation lives
JAVA_HOME="/usr/java/latest"
# Where your tomcat installation lives
CATALINA_BASE="/opt/apache-tomcat"
CATALINA_HOME="/opt/apache-tomcat"
CATALINA_OUT="/var/log/apache-tomcat/catalina.out"
JASPER_HOME="/opt/apache-tomcat"
CATALINA_TMPDIR="/opt/apache-tomcat/temp"
CATALINA_OPTS="-Xms1G -Xmx2G"
# What user should run tomcat
TOMCAT_USER="apache-tomcat"
# Run tomcat under the Java Security Manager
SECURITY_MANAGER="false"
# Time to wait in seconds, before killing process
SHUTDOWN_WAIT="90"
# Whether to annoy the user with "attempting to shut down" messages or not
SHUTDOWN_VERBOSE="false"
# Set the TOMCAT_PID location
CATALINA_PID="/var/run/apache-tomcat/apache-tomcat.pid"
# Connector port is 8080 for this tomcat instance
CONNECTOR_PORT="8080"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]