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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 8B8B224041 for ; Thu, 25 Jul 2024 03:16:47 +0200 (CEST) Received: (qmail 46718 invoked by uid 89); 25 Jul 2024 01:17:13 -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 46710 invoked from network); 25 Jul 2024 01:17:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=heuristicsystems.com.au; s=hsa; t=1721870141; x=1722474942; bh=rZOuhkp68Nd00FV2qA3JR1zeuUBe45VRlnhY3QMGWJ0=; h=Message-ID:Date:Subject:To:From:Cc; b=H1qjKRXaDTmqaEWqeLFyewLOzJaYEq6Ib9X0+GqPDG3rrw/cWJ+Hn1YylBP4HPqa8 gzyZNFWVocCNjYD646LquXCRhzlDTCVFHeSwS6qHosEret9u+S8hBCKVYV2Fpo8Dn0 yTiOPAE1hDm9TlIkUZvJktAWUwJmkpBqN8gZFGWpxJfne2d8GfTnr X-Authentication-Warning: b3.hs: Host bigears.hs [10.0.5.4] claimed to be [10.0.5.4] Message-ID: <4664aee1-4ae5-4abb-b02a-3520b259655d@heuristicsystems.com.au> Date: Thu, 25 Jul 2024 11:15:41 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Possible to shut down an s6 service via command rather than signal? To: Brett Neumeier References: <20240724123027.8c04a742f5ee892725c2120f@freesa.org> Content-Language: en-GB From: Dewayne Geraghty Cc: supervision@list.skarnet.org In-Reply-To: <20240724123027.8c04a742f5ee892725c2120f@freesa.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Brett, I had a similar issue. (Please note: I do not use qemu and only use FreeBSD/HardenedBSD, with lots of lightweight jails). I'm surprised you need to write a catcher for signals as that should be caught by your init (Id:1) process which should be graceful? I replaced init with s6-svscan, so here's what I've done, for shutdown.sh (and lots of other maintenance things) s6-rc -v 9 -da -t 10000 change > /dev/console s6-rc -v 9 -Da -t 20000 change > /dev/console sync 2>&1 > /dev/console For .s6-svscan i have scripts to capture signals for: SIGINT SIGTERM SIGUSR1 SIGUSR2 finish crash Each does similar things except finish, which perform sync umounts lots of other things (graceful jail shutdown, transmit closed log files) and initiates a halt or reboot depending on the signal. An example of signal capture: .s6-svscan/SIGUSR2 #!/usr/local/bin/execlineb -S0 fdmove -c 2 1 redirfd -wnb 1 /dev/console foreground { echo Executing SIGUSR2 } exec /s/scan/.s6-svscan/finish USR2 You should be able to do everything in the context of s6 :) Good luck.