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.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8568 invoked from network); 12 Jan 2023 00:51:33 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 12 Jan 2023 00:51:33 -0000 Received: (qmail 10710 invoked by uid 89); 12 Jan 2023 00:51:52 -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 10703 invoked from network); 12 Jan 2023 00:51:51 -0000 From: "Laurent Bercot" To: supervision@list.skarnet.org Subject: Re: s6 vs shell wrappers for client connections Date: Thu, 12 Jan 2023 00:51:24 +0000 Message-Id: In-Reply-To: <20230111151503.2a4bb0c8@mydesk.domain.cxm> References: <20230111151503.2a4bb0c8@mydesk.domain.cxm> Reply-To: "Laurent Bercot" User-Agent: eM_Client/9.2.1222.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >if s6-svstat myserver; then > client_binary >else > send_email_to_admin > faux_client_binary >fi Please don't do this. - As Steve would be able to tell you if he had read the documentation page for s6-svstat (https://skarnet.org/software/s6/s6-svstat.html), "s6-svstat myserver"'s exit code does not mirror whether myserver is running or not. If myserver is a live service directory, s6-svstat will print a line to stdout summarizing the status of the service, then exit 0. Zero, even if the service is down, so client_binary will fail. s6-svstat will only exit nonzero if an error occurs or if no supervisor is running on myserver, which is not what this script aims to test. - It is good to notify the admin when something on the system is not working correctly. Doing it automatically from a script, however, is not a good idea. Spamming the admin's mailbox via automated messages is an great way to get yourself ignored at best (which defeats the purpose of reporting bugs) or banned at worst. - If you're using s6, as I said earlier, you're supposed to be able to assume that myserver is running, and you don't have to write such wrappers, even ones that would work. -- Laurent