[systemd-devel] Service Type for Tomcat

Mantas Mikulėnas grawity at gmail.com
Tue Apr 18 17:58:02 UTC 2017


On Tue, Apr 18, 2017 at 8:44 PM, Igal @ Lucee.org <igal at lucee.org> wrote:

> I've read about the difference between "forking" and "notify", but am not
> sure how it really applies in real life.
>
> Can someone tell me what would be the consequences of setting Tomcat (or
> any Java-based service, for that matter) to Type=notify instead of
> Type=forking?  Examples I see online use forking but I'm not sure that
> that's the right way to go.
>
Both types depend on the service process actually sending the correct kind
of notification once it's ready to work. (This helps systemd avoid starting
dependent services too early.) If the notification is not received in ~90
seconds, systemd considers the service failed to start and kills all
remaining processes.

For example, with Type=forking, systemd expects the main process to "fork
into background" (daemonize) once it's ready. Similarly, if you use
Type=notify, systemd will wait for "READY=1" to be sent over a Unix socket.

Tomcat does not seem to have any code that would implement Type=notify, so
if you try to use it, your service will spend its first minute in the
'activating' stage, and get immediately killed afterwards.

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170418/df3dc8bc/attachment.html>


More information about the systemd-devel mailing list