From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#23170: [PATCH shepherd] Restart dependent services on service restart Date: Sat, 25 Aug 2018 16:41:03 +0200 Message-ID: <87bm9qbjb4.fsf@gnu.org> References: <874lfi65rv.fsf@zancanaro.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftZlM-0007Nd-Eo for bug-guix@gnu.org; Sat, 25 Aug 2018 10:42:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ftZlK-00013C-Jl for bug-guix@gnu.org; Sat, 25 Aug 2018 10:42:04 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55694) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ftZlK-00012w-FD for bug-guix@gnu.org; Sat, 25 Aug 2018 10:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ftZlK-0003kx-C0 for bug-guix@gnu.org; Sat, 25 Aug 2018 10:42:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <874lfi65rv.fsf@zancanaro.id.au> (Carlo Zancanaro's message of "Sat, 25 Aug 2018 21:33:47 +1000") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Carlo Zancanaro Cc: 23170@debbugs.gnu.org Hi again! :-) Carlo Zancanaro skribis: > I've written a patch to fix this. It's not super smart, but it should > do the job. I wonder if there are cases where one might want to restart a service without restarting its dependent services. We can probably ignore it for now, but perhaps we=E2=80=99ll need to add a flag or a separate action = later. Thoughts? > From 50dd3ef4888b04ea3b869da893b23ad69fad8971 Mon Sep 17 00:00:00 2001 > From: Carlo Zancanaro > Date: Sat, 25 Aug 2018 20:32:11 +1000 > Subject: [PATCH] service: Restart dependent services on service restart > > * modules/shepherd/service.scm (required-by?): New procedure. > (stop): Return a list of canonical-names for stopped dependent services, > including transitive dependencies. > (action)[restart]: Start services based on the return value of stop. > (fold-services): New procedure. > * tests/restart.sh: New file. > * Makefile.am (TESTS): Add tests/restart.sh. [...] > +# Restart test1 and make sure that both services are still running (ie. = that > +# test2 hasn't been stopped) > +$herd restart test1 > +$herd status test1 | grep started > +$herd status test2 | grep started > + > +# Now let's test with a transitive dependency > +$herd start test3 > +$herd status test3 | grep started > + > +# After restarting test1 we want test3 to still be running > +$herd restart test1 > +$herd status test1 | grep started > +$herd status test2 | grep started > +$herd status test3 | grep started For clarity, should we do an explicit =E2=80=9Cherd stop test1=E2=80=9D fol= lowed by =E2=80=9Cherd start test1=E2=80=9D? I know it=E2=80=99s currently equivale= nt under the hood, but it might be slightly clearer. WDYT? Otherwise it LGTM. Thanks for addressing these longstanding issues! Ludo=E2=80=99.