https://bz.apache.org/bugzilla/show_bug.cgi?id=63041

--- Comment #27 from Rainer Jung <rainer.j...@kippdata.de> ---
Excellent analysis!

I *think* the "&" at the end of the line is only useful, if a pipe command is
actually being used. So one could put it into the construction of the string
variable to which we pipe, just as we prefix the command with "|" we could
suffix it with "&".

Nevertheless systemd will probably have trouble identifying the backgrounded
Java process.

When using systemd in our own distribution, we include

Type=forking
...

PIDFile=/path/to/my/logs/catalina.pid
ExecStart=/path/to/catalina_home/bin/catalina.sh start
ExecStop=/path/to/catalina_home/bin/catalina.sh stop

in our service description file (or whatever CATALINA_PID is). So it might make
sense to better support systemd by providing a template for this. 

Using the PIDFile, systemd should be able to correctly detect, whether Tomcat
is running or not (once we are writing te correct pid to it).

As an example, the full file is the following, where all XXX params are patched
before copying the file to systemd during running a custom "service-install"
script target.

[Unit]

RequiresMountsFor=XXXKPDT_CATALINA_HOMEXXX XXXKPDT_CATALINA_BASEXXX
SourcePath=XXXKPDT_CATALINA_BASEXXX/bin/tomcat-SERVICE.systemd
After=network.target nss-lookup.target

[Service]

Type=forking
Restart=on-failure
# Disable OOM killer for this service
OOMScoreAdjust=-1000

Environment=CATALINA_HOME=XXXKPDT_CATALINA_HOMEXXX
Environment=CATALINA_BASE=XXXKPDT_CATALINA_BASEXXX
Environment=TC_USER=XXXKPDT_TC_USERXXX
Environment=JAVA_HOME=XXXKPDT_JAVA_HOMEXXX

User=XXXKPDT_TC_USERXXX
PIDFile=XXXKPDT_CATALINA_PIDXXX
ExecStart=XXXKPDT_CATALINA_HOMEXXX/bin/catalina.sh start
ExecStop=XXXKPDT_CATALINA_HOMEXXX/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to