Possible to shut down an s6 service via command rather than signal?

From: Brett Neumeier <random_at_freesa.org>
Date: Wed, 24 Jul 2024 12:30:27 -0500

I'm trying to set up supervision for a QEMU virtual machine on a machine that uses s6 and s6-rc for service management. I can certainly stop the VM process by sending it a signal -- it appears that SIGINT, SIGTERM, and SIGPWR all work for this -- but none of those trigger a graceful shutdown of the operating system running in the VM, they just cause QEMU to terminate.

I can tell QEMU to send an ACPI poweroff request to the VM by sending a "system_powerdown" command to the QEMU monitor; the way I have this currently set up, I can do that by simply running a command like:

echo system_powerdown | monitor.in

I'm wondering, is there a reasonably idiomatic way to do this with s6 or s6-rc? Or should I do something like write a wrapper script that catches SIGTERM and converts that into a system_powerdown command like the above? Or is there some other, less kludgy, alternative?

(I'm also pondering patching my QEMU so that I can have it run the same ACPI shutdown routine when it catches a signal, which would be a way of making it play nicely with standard s6 idioms, but I'd *rather* not have to do that.)

Cheers!


-- 
Brett Neumeier <random_at_freesa.org>
Received on Wed Jul 24 2024 - 19:30:27 CEST

This archive was generated by hypermail 2.4.0 : Wed Jul 24 2024 - 19:31:05 CEST