>OK, great! I just sent my patch series in a separate reply. I'm happy >to have a tech discussion about it, and I could possibly change the >patch series based on the discussion, or if it is determined that my >patch series should not be accepted, I would accept that as well. Eh, "fix old compiler warnings" doesn't require much discussion :) >That's when >I found runit which did support the concept of a service becoming >available with its "sv start" command and a "./check" service script. >This way, I could start it and wait for it to become available before >starting something else. > >So, if s6 can do something similar, I'd be happy to try it out! Can it? Yes it can, and it does you one better: if your service supports it, s6 can tell you that it's ready as soon as the service says it is, without the need for polling at all. (https://skarnet.org/software/s6/notifywhenup.html for the tech details.) And s6 has, for instance, commands that block until a service is ready, so you can write your startup sequence without "sv check" shenanigans. >I see something called sdnotify-wrapper, so maybe I should have a look >at that? (It was mentioned to me off-list.) sdnotify-wrapper will only be useful if your daemon is using the NOTIFY_SOCKET mechanism (aka sd_notify()) to tell systemd when it is ready. If it's the case, then yes, you can use sdnotify-wrapper in your s6 run script and it should automatically do the right thing. But if you have control over your daemon's source, or the daemon supports it natively (typically via a command line option), the s6 mechanism for readiness notification is much simpler and lighter. It's just "the daemon writes a line of text when it's ready, on any file descriptor it wants, and then closes that file descriptor". For instance, if your daemon writes "ok" to its stdout when it's ready (and doesn't write any newline beforehand), you can just use that to inform s6. And if your daemon doesn't do anything of the sort, you can still poll it with a "./check" script (or "./data/check" in s6 parlance) as you do with runit: just prepend your run script with https://skarnet.org/software/s6/s6-notifyoncheck.html and your check script will be automatically invoked as necessary, and the result will be directly piped into the readiness notification mechanism. -- Laurent