On Wed, 4 Dec 2024 21:05:45 +0100
Paul Sopka <psopka_at_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 <random_at_freesa.org>
Received on Wed Dec 04 2024 - 21:18:21 CET