Subject: [bug#30532] [PATCH] Shepherd: Terminate all services upon SIGTERM or SIGHUP

From: [email-masked] (Ludovic Courtès)
Date: Tue, 27 Feb 2018 10:45:58 +0100

Hi Carlo,

Carlo Zancanaro <[email-masked]> skribis:

> I use Shepherd to manage my user session, and if I log out then
> Shepherd leaves all my services running. This patch handles SIGTERM
> and SIGHUP to prevent that.

Good catch!

> I hope the guix-patches mailing list was the right place to send
> it. From what I understand Shepherd development is done through the
> guix lists, so it seemed to make the most sense to me.

Yes, that’s perfect.

> It's also worth noting that I had to run `gettextize` to get Shepherd
> to build on current master, but I haven't included those changes in
> this commit (because I don't know what should be committed and what
> shouldn't).

Right, I’m not sure what’s wrong with that.  I’ve committed the same
files under po/ as I did for Guix:

--8<---------------cut here---------------start------------->8---
$ git ls-files po/
po/Makevars
po/POTFILES.in
--8<---------------cut here---------------end--------------->8---

> From aabb9c6b1b52189d20339531de0b8b96bcace69f Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <[email-masked]>
> Date: Tue, 20 Feb 2018 02:52:47 +1100
> Subject: [PATCH] Terminate all services upon SIGTERM or SIGHUP
>
> * modules/shepherd.scm (main): Add SIGTERM and SIGHUP handlers which stop
>   root-service.
> * tests/sigterm.sh, tests/sighup.sh: New files.
> * Makefile.am (TESTS): Add tests/sigterm.sh and tests/sighup.sh.

Excellent!

I have one request: since the three tests differ only in the signal
name, could you make it a single test file and have a loop like:

  for signal in SIGTERM SIGHUP SIGINT

TIA,
Ludo’.