-1

I have multiple tomcat instances that have to start in order. With the help of After= and Requires= that isn't a real problem with multiple service files.

My problem is now that I need to make suche that the webapp inside is started before the next tomcat starts.

Is it possible to define some kind of delay to assure the startup of the service? I couldn't find anything in the documentation.

Otherwise my last chance would be to wrap around the catalina.sh call with a shell script that I call instead that ensures the startup, but I would prefer to do it with systemd only.

Also, I don't want to modify the code basis, so I can't add sd_notify or anything like it.

Hoall
  • 184
  • 16
  • 1
    Possible duplicate of [Systemd http health check](http://stackoverflow.com/questions/39679067/systemd-http-health-check) – nir0s Mar 20 '17 at 17:58
  • Possible duplicate of: http://stackoverflow.com/questions/39679067/systemd-http-health-check.. which you can see to solve your quest. – nir0s Mar 20 '17 at 17:58
  • Maybe that's true, but the answer given isn't detailed enough for me, sorry. – Hoall Mar 21 '17 at 15:42

2 Answers2

1

If Systemd has to wait until process-A completes its operations(in your case starting of webapp) and inform back to systemd so that systemd starts next process-B which is dependent on process-A, then process-A has to implement a sd_notify() which informs systemd that process-A is started and it proceeds with starting of dependent apps.

Read about sd_notify here

Also along with sd_notify() inside your process-A you need to add the Type=notify in process-A.service file for systemd to wait on sd_notify().

DarkKnight
  • 597
  • 3
  • 15
0

In that case I don't want to modify anything on the software an provided software scripts.

A solution I came across fitted my needs. ExecStartPost allows you to run a test or whatever to test the service is up or you just use it for a sleep or so. It counts to the bootup and systemd waits with returning until ExecStartPost returned (successfully) too.

Hoall
  • 184
  • 16