Re: A couple of questions

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Tue, 26 Jul 2022 12:15:32 +0000

>Hi Laurent, I'm using s6/66 and I would like to ask two important things:
>1) is it possible to start a service A after another service B with a
>specific delay? For example start a service A exactly 5 seconds after the
>service B?

  There's no specific support for that, no. In general, fixed delays are
a poor substitute for readiness: chances are that what you really want
is for service A to start when service B is *ready*, but since B is
not notifying readiness, you guesstimated that 5 seconds is a safe and
acceptable delay, and B will be ready by then so A should not fail.

  s6 does away with guesses by providing readiness notifications.
Basically, you need to configure B to let the supervisor know when it
is ready. Then the supervisor will inform the service manager, and A
will start.

  https://skarnet.org/software/s6/notifywhenup.html

  The same files mentioned in the link above, which describes a pure s6
setup (i.e. no service manager and no high-level interface), can be used
in an s6-rc service: run, notification-fd, and (if you have no other
choice) data/check. I'm not sure how 66 wraps s6-rc service definitions,
but it should also map to these files pretty closely.


>2) im trying to covert a systemd service to a 66 frontend service but I see
>that the type is "notify", while I only found classic, longrun, oneshot and
>module in the template. Isn't there anything like that in 66?
>Thanks in advance.

  'notify' means that the daemon has been built with sd_notify support,
so
it is able to notify its readiness to systemd. s6 has the same idea,
but implemented differently: check whether the daemon has an option
to write a line to some file descriptor when it's ready, as shown in the
link above, instead of using sd_notify. (It should: sd_notify is a much
more complex mechanism than just writing a line. If the daemon cannot do
that, it should be patched; and in the meantime, you can use
s6-notifyoncheck.)

  Notification shenanigans aside, your daemon will be a regular
'longrun',
and anything 'longrun' should apply to your service.

  If you have more 66-specific questions, however, you should ask Obarun
experts, which I'm not. ;)

--
  Laurent
Received on Tue Jul 26 2022 - 14:15:32 CEST

This archive was generated by hypermail 2.4.0 : Tue Jul 26 2022 - 14:16:02 CEST