tomcat: Don't use forking in tomcat.service
Some checks failed
continuous-integration/drone/pr Build is failing

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.
This commit is contained in:
Mathieu Trossevin 2021-11-24 10:18:39 +01:00
parent 82694ef5e9
commit 503806e9e6
Signed by: mtrossevin
GPG key ID: D1DBB7EA828374E9
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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