Skip to content

Instantly share code, notes, and snippets.

@obatiuk
Created February 24, 2017 05:54
Show Gist options
  • Save obatiuk/15c84fb25826d4f39a303a454087e85a to your computer and use it in GitHub Desktop.
Save obatiuk/15c84fb25826d4f39a303a454087e85a to your computer and use it in GitHub Desktop.
Example systemd unit file for tomcat 7.x
# Systemd unit file for tomcat 7.x
[Unit]
Description=Apache Tomcat 7.x Web Application Container
Wants=syslog.target network.target
After=syslog.target network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/java/latest
Environment=CATALINA_PID=/run/tomcat.pid
Environment=CATALINA_HOME=/home/tomcat/tomcat
Environment=CATALINA_BASE=/home/tomcat/tomcat
Environment='CATALINA_OPTS=-Xms1G -Xmx1G -Djava.net.preferIPv4Stack=true'
Environment='JAVA_OPTS=-Djava.awt.headless=true'
ExecStart=/home/tomcat/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