On Wed, 4 Dec 2024 21:05:45 +0100
Paul Sopka <pso...@sopka.ch> wrote:
> > You could use `s6-rc -a list`, perhaps? It lists all services that are in 
> > the active state.
> >[...]
> > Does that give you what you want?
> Unfortunately not, since I specifically need to *wait*
> and waiting based on "state-info" would require polling,
> which I would rather avoid.

Ah, I see: from your external script, you do not want to know *whether* a 
oneshot service has completed; you want to block *unless or until* it has 
completed?

In that case, I would use `s6-ftrig-notify` in the oneshot service, and both 
`s6-rc -a list` and `s6-ftrig-wait` in the external script:

in the oneshot, as the last action taken before quitting, use `s6-ftrig-notify` 
to send an event to a fifodir;
in the external script, `s6-rc -a list | grep -q $(oneshot_service_name)` to 
proceed if the oneshot is already up, and then if it is not up, `s6-ftrig-wait` 
to block until it is.

Or, as you say, you can use fifodirs directly without the convenience programs 
that interact with them already.

There might be a race condition there, but that's something you can surely work 
around if it's a concern.

-- 
Brett Neumeier <ran...@freesa.org>

Reply via email to