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=-1.0 required=5.0 tests=MAILING_LIST_MULTI 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 2E86D2EFA2 for ; Tue, 3 Dec 2024 01:56:34 +0100 (CET) Received: (qmail 2071 invoked by uid 89); 3 Dec 2024 00:56:59 -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 2063 invoked from network); 3 Dec 2024 00:56:59 -0000 From: "Laurent Bercot" To: "Paul Sopka" , supervision@list.skarnet.org Subject: Re[2]: Have s6-svscan send SIGTERM to one logger Date: Tue, 03 Dec 2024 00:56:31 +0000 Message-Id: In-Reply-To: <66b93398-3f98-4b6c-b3f2-d91054e727fe@sopka.ch> References: <1a2c16c9-a1af-45f5-82ca-03c8c6b9da2b@sopka.ch> <66b93398-3f98-4b6c-b3f2-d91054e727fe@sopka.ch> Reply-To: "Laurent Bercot" User-Agent: eM_Client/10.1.4588.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >This is what I did before, but in an effort to make the "sub-supervision-t= ree" >independent of whatever init-system/service manager is used for the main t= ree, >I tried what I described. Well, it's not very satisfying, but I understand the wish, so here is how I do it on Alpine Linux. You can take inspiration from it: https://gitlab.alpinelinux.org/alpine/aports/-/raw/master/main/s6/s6-svscan= boot This is invoked by openrc in order to start a new supervision tree. OpenRC doesn't provide any native logging infrastructure, so the script creates its own catch-all logger. The fd dance is similar to what s6-linux-init does. Killing s6-svscan *should* also make the catch-all logger die on its own. (It was buggy in previous versions, but with the current version of s6, it should work). Note that /dev/console is explicitly mentioned towards the end, because openrc doesn't provide an open fd to it to its services. If you want your script to be portable to any service manager, you should probably do the same. Else, you could try saving the script's stderr instead, and making it s6-svscan's console holder, but that requires a little more fd dancing, and that won't work with OpenRC or other service managers that don't give you a suitable stderr fallthrough. -- Laurent