Re: Scripting Stage 3 and 4
"Laurent Bercot" <[email protected]> Thu, 09 Jan 2025 23:19:58 +0000
| Newsgroups | gmane.comp.sysutils.supervision.general |
|---|---|
| Message-ID | <[email protected]> |
>Now I was wondering why you, Laurent recommend against using the finish script of s6-svscan >for the shutdown procedure (here: https://skarnet.org/software/s6/s6-svscan-1.html#stage3). > >Using that would make good portion of my implementation more elegant and simple 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