Skip to content

Instantly share code, notes, and snippets.

View MissakaI's full-sized avatar

Missaka Iddamalgoda MissakaI

View GitHub Profile
@drmalex07
drmalex07 / README-tomcat-as-systemd-service.md
Last active April 20, 2024 17:18
An example configuration for Tomcat as systemd service. #tomcat #systemd #systemd.service

README

Let Tomcat is download and installed under /opt/tomcat. Also, let tomcat be a non-provileged user under which the server will be running.

We assume that we keep server's binaries under /opt/tomcat and we will create a server instance named foo under /var/tomcat/ (carrying its own conf, logs, webapps, work, lib directories). See also https://dzone.com/articles/running-multiple-tomcat.

Create a template service unit file at /etc/systemd/system/tomcat@.service:

@zengxs
zengxs / tomcat.service
Last active August 14, 2022 17:26
tomcat systemd service script
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid