Re: service wait for prereqs

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Wed, 15 Jul 2020 19:34:40 +0000

>Is there a way to wait starting a service until a device is ready for being used?

  That's a service-specific and nonportable thing, so, there's no generic
solution.
  However, if for a given service you have a way to wait until the
device appears, then it's easy.

  Pure s6 solution: put the wait-until-device-appear program at the
start of your run script. It will be run every time the service
restarts, but the check should be instant after the first time.

  s6-rc solution (better, because it's really a service management
pattern, not a supervision pattern) : make your longrun depend on a
oneshot that runs your device-waiting program.

  If you don't have a program that waits until a device is there, then
you have to resort to polling, unfortunately. For the pure s6 way,
s6-notifyoncheck can help you.

  But if you're just waiting for nodes to appear in /dev, on Linux,
you can use inotify: it works on devtmpfs. I could probably add a
program to s6-linux-utils that waits for a set of devices to appear,
then exits (or execs).

--
  Laurent
Received on Wed Jul 15 2020 - 19:34:40 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC