From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9503 invoked from network); 10 Jan 2023 22:23:46 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 10 Jan 2023 22:23:46 -0000 Received: (qmail 27886 invoked by uid 89); 10 Jan 2023 22:24:09 -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 27879 invoked from network); 10 Jan 2023 22:24:09 -0000 Date: Tue, 10 Jan 2023 22:23:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1673389421; x=1673648621; bh=BNt4wrXaicQuM/BsbZoDqklF2WL2Vp59dZGb7c5t+Fw=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=txeqI0pTIa/0abq+9JXFTkD/3ZjID+FJbfYN0fOFUTFrY89UC7ZN0sdwhuKUmGXGG Htfg6qTvcci6eOjztZKVaWeOrP26LKn3Cm3hiU4VThyaK6y139e7QNKa0jOJyuEfnT Ca0g2b/D6CVQfAUAv9lrFb0KKTzWRkvOcv3oGLdKSYI9YaQmp69K8UJHuQZcYkA8Y6 AX0DLWAkKpYaNbAvogi45Tdu3lk112EXf6nd8W5e4I1Vn2A9py5U2ysaH08wrpx5Ez lbTZ1KwUBWnifHTeUDw3/cL2GFDL5PEeq3A+llxKydI36XMFkINBYkUB/7Nl703tac r7EWoCR45kC8Q== To: "supervision@list.skarnet.org" From: "artur.brzozowski" Subject: s6 vs shell wrappers for client connections Message-ID: Feedback-ID: 11846861:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi. I'm wondering if and how s6 can help with the following user-oriented problem: You have a program that can be started normally or as a service that accepts connections through a socket. For client connections, an additional binary is supplied. The simplest way to make sure that the program launches regardless of whether there's a server running or not is a wrapper script that executes the right binary based on socket's availability. Example of this is the 'foot' terminal emulator - it has 'foot [--server]' and footclient binaries. How, if at all, could s6 help remove this executable ambiguity, the need for checking and wrapping? The goal is to always run the program correctly: if server is available, connect to it with client binary, if not - use the standard one. In a not-so-old issue thread [1] I read: > > User: st3r4g > For example, with s6-rc you would have a foot server service > running foot -s -p 3 and have notification-fd set to 3 in the > service directory. Then you can have e.g. footclient irssi > depend on the foot server service, and they will all be started > in the correct order, as soon as possible. > > User: dnkl > The --print-pid option was designed with s6 in mind ;) To continue with the example: I set up 'foot' as described above. The result is that s6-svscan/supervise starts the 'foot' server, places an 'S' socket in the service directory and sits there. I can connect to the server by pointing to socket in service directory $ footclient -s "$s6-foot-servdir/S" This however, still requires me to check for the socket and if-else the binary and options each time I want to start the program, doesn't it? Does s6 offer a remedy? Any pointers, even to the correct man page for this, would be appreciated. Best wishes, Artur [0] https://codeberg.org/dnkl/foot [1] https://codeberg.org/dnkl/foot/issues/604#issuecomment-267617