Skip to content

Instantly share code, notes, and snippets.

@djraw
Forked from obatiuk/tomcat.service
Last active September 13, 2018 09:01
Show Gist options
  • Save djraw/f378dc78d655c6b126c21b508b356a4b to your computer and use it in GitHub Desktop.
Save djraw/f378dc78d655c6b126c21b508b356a4b to your computer and use it in GitHub Desktop.
Example systemd unit file for tomcat 7.x
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
Wants=syslog.target network.target
After=syslog.target network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/java/jre
Environment=CATALINA_PID=/run/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms1G -Xmx1G -Djava.net.preferIPv4Stack=true'
Environment='JAVA_OPTS=-Djava.awt.headless=true'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID
PIDFile=/run/tomcat.pid
SuccessExitStatus=143
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment