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 45F5822216 for ; Fri, 10 Jan 2025 00:20:04 +0100 (CET) Received: (qmail 40481 invoked by uid 89); 9 Jan 2025 23:20:29 -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 40474 invoked from network); 9 Jan 2025 23:20:29 -0000 From: "Laurent Bercot" To: "supervision@list.skarnet.org" Subject: Re: Scripting Stage 3 and 4 Date: Thu, 09 Jan 2025 23:19:58 +0000 Message-Id: In-Reply-To: <1dcb4b00-db5d-49bd-8598-fd6b2e5febdd@sopka.ch> References: <1dcb4b00-db5d-49bd-8598-fd6b2e5febdd@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 >Now I was wondering why you, Laurent recommend against using the finish sc= ript of s6-svscan >for the shutdown procedure (here: https://skarnet.org/software/s6/s6-svsca= n-1.html#stage3). > >Using that would make good portion of my implementation more elegant and s= imple No, it would not, and the link you quoted explains why. As long as you have things to do, and especially if you have several processes involved - as you have in an execline script - you want to keep a real init system as pid 1, not a shell or a random sequence of executables as would happen with execline. You don't want to leave zombies around potentially preventing unmounts, you want to be able to recover and get a shell until the very end, and you don't want your pid 1 to accidentally get killed. If you leave s6-svscan running, you have all this for free; if you terminate it and run your shutdown sequence as its finish script, you need to pay attention to this for the entirety of stages 3 and 4. I tried both approaches. Keeping s6-svscan as pid 1 until the very end was by far the safer, less brittle option. Even if it means you need to add a little dance to have the supervision tree restart what you want when you want it and nothing else - the peace of mind it brings is priceless. -- Laurent