Skip to content

Instantly share code, notes, and snippets.

@icicimov
Created August 21, 2018 06:47
Show Gist options
  • Save icicimov/5d77c8ed7576841a0e2686cb496a7b35 to your computer and use it in GitHub Desktop.
Save icicimov/5d77c8ed7576841a0e2686cb496a7b35 to your computer and use it in GitHub Desktop.
[Unit]
Description=Apache Tomcat Web Application Container
Documentation=http://tomcat.apache.org/tomcat-9.0-doc/
After=syslog.target network.target
After=network-online.target
Wants=network-online.target
[Service]
User=tomcat
Group=tomcat
PermissionsStartOnly=true
UMask=0007
TasksMax=131070
RestartSec=10
Restart=always
TimeoutStartSec=240
TimeoutStopSec=60
WorkingDirectory=/usr/share/tomcat
EnvironmentFile=-/etc/default/tomcat
Environment=JRE_HOME=/usr/lib/jvm/default-java
Environment=JAVA_HOME=/usr/lib/jvm/default-java
Environment=CATALINA_PID=/var/run/tomcat.pid
Environment=CATALINA_HOME=/usr/share/tomcat
Environment=CATALINA_BASE=/usr/share/tomcat
Environment=CATALINA_TMPDIR=${CATALINA_BASE}/temp
#Environment=CLASSPATH="/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar"
Environment="CLASSPATH=/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/tomcat/bin/commons-daemon.jar:/usr/share/tomcat/lib"
Environment=SYSTEMD_LOG_LEVEL=debug
ExecStartPre=/bin/mkdir -p /var/log/tomcat
ExecStartPre=/bin/chown -R tomcat:tomcat /var/log/tomcat
ExecStart=/usr/bin/env ${JAVA_HOME}/bin/java \
$JAVA_OPTS $CATALINA_OPTS \
-classpath ${CLASSPATH} \
-Dcatalina.base=${CATALINA_BASE} \
-Dcatalina.home=${CATALINA_HOME} \
-Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS} \
-Djava.io.tmpdir=${CATALINA_TMPDIR} \
-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
org.apache.catalina.startup.Bootstrap \
start
ExecStop=/usr/bin/env ${JAVA_HOME}/bin/java \
$JAVA_OPTS \
-classpath ${CLASSPATH} \
-Dcatalina.base=${CATALINA_BASE} \
-Dcatalina.home=${CATALINA_HOME} \
-Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS} \
-Djava.io.tmpdir=${CATALINA_TMPDIR} \
-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
org.apache.catalina.startup.Bootstrap \
stop
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment