From 503806e9e65caa37a3845adf6dc4709573b50782 Mon Sep 17 00:00:00 2001 From: Mathieu Trossevin Date: Wed, 24 Nov 2021 10:18:39 +0100 Subject: [PATCH] tomcat: Don't use forking in tomcat.service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having `ExecStart=[…]/catalina.sh run` and `Type=simple` result in tomcat doing everything systemd is expecting without the need to fork or adding a secondary daemon manager just for this tomcat service. That means that we don't need ExecStop anymore as the shutdown port is only there as a OS agnostic shutdown method. The jsvc (aka officially documented) method of launching tomcat use signals to stop the service just as systemd will when no ExecStop= is in the unit file so we know it will work properly. Moreover add the SyslogIdentifier= directive to make each tomcat easier to find in the system log. --- CHANGELOG.md | 1 + tomcat/templates/tomcat.service.j2 | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60938983..6d93638f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The **patch** part changes is incremented if multiple releases happen the same m * mongodb: Deny the install on Debian 11 « Bullseye » when the version is unsupported * mongodb: Support version 5.0 (for buster) * mongodb: Allow to specify a mongodb version for buster & bullseye +* tomcat : tomcat.service without forking and secondary daemon manager (`catalina.sh start` which is launched by `startup.sh` try to manage the tomcat daemon) ### Fixed diff --git a/tomcat/templates/tomcat.service.j2 b/tomcat/templates/tomcat.service.j2 index e82bfca9..7bd322ab 100644 --- a/tomcat/templates/tomcat.service.j2 +++ b/tomcat/templates/tomcat.service.j2 @@ -7,9 +7,10 @@ WorkingDirectory=%h Environment="CATALINA_BASE=%h" EnvironmentFile=%h/conf/env UMask=0002 -ExecStart=/usr/share/tomcat{{ tomcat_version }}/bin/startup.sh -ExecStop=/usr/share/tomcat{{ tomcat_version }}/bin/shutdown.sh -Type=forking +ExecStart=/usr/share/tomcat{{ tomcat_version }}/bin/catalina.sh run +Restart=on-failure + +SyslogIdentifier=tomcat-instance-%u [Install] WantedBy=default.target -- 2.39.2