From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.4 Received: from alyss.skarnet.org (alyss.skarnet.org [95.142.172.232]) by inbox.vuxu.org (Postfix) with SMTP id 6CC0E21D3F for ; Wed, 4 Dec 2024 21:18:27 +0100 (CET) Received: (qmail 53559 invoked by uid 89); 4 Dec 2024 20:18:53 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Received: (qmail 53552 invoked from network); 4 Dec 2024 20:18:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freesa.org; s=20240917; t=1733343501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=knV5D76rshiUxpFXNPgHnl/oZZMxY2leQtiOQDvrGNY=; b=PBdpNU6svHorhC79E9MOo0sqkvHoAN1LeUm4zw1VLt29XR3EDskUBFiMJ2OSvP/0P/g/00 HpHuvS2VQVNtZXRiJ9Vhbo8sZhZAtgsu8mKjK+TU9u3d4syY84KYyI/5BePF+RGF0ml10M UTUql6G4AsM4UQe1/6Z1ezDJp0fzEAc= Date: Wed, 4 Dec 2024 14:18:21 -0600 From: "Brett Neumeier via supervision" Reply-To: Brett Neumeier To: Paul Sopka Cc: "supervision@list.skarnet.org" Subject: Re: Have an external script wait for a oneshot service Message-Id: <20241204141821.ee2a00c996c948f2feb42dec@freesa.org> In-Reply-To: <2571a89b-ac74-4d9e-b8c6-ff0fe05cebb7@sopka.ch> References: <20241204140015.4e635037306d88117e053994@freesa.org> <2571a89b-ac74-4d9e-b8c6-ff0fe05cebb7@sopka.ch> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 4 Dec 2024 21:05:45 +0100 Paul Sopka 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