From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdNAW-00069q-IM for guix-patches@gnu.org; Wed, 11 Jul 2018 18:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdNAV-0006ID-HM for guix-patches@gnu.org; Wed, 11 Jul 2018 18:01:04 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fdNAV-0006I2-DV for guix-patches@gnu.org; Wed, 11 Jul 2018 18:01:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fdNAU-0006OA-2I for guix-patches@gnu.org; Wed, 11 Jul 2018 18:01:03 -0400 Subject: [bug#26830] Allow services to implement a 'reload' action Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87d1bjtlpd.fsf@lassieur.org> <86vapa6nyi.fsf@gmail.com> <87vap7kryj.fsf@gnu.org> Date: Thu, 12 Jul 2018 00:00:00 +0200 In-Reply-To: <87vap7kryj.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 11 May 2017 23:24:04 +0200") Message-ID: <87bmbdigbj.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Mathieu Othacehe Cc: 26830@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Hello! ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > The logical next step of this series will be to have the service upgrade > code in =E2=80=98guix system reconfigure=E2=80=99 invoke this action when= it is defined. > That will be awesome. > > Some comments: > > + #:actions (make-actions > + (reload > + "Reload the service's configuration fi= les." > + #$(shepherd-service-reload service))))= )))) > > Here I think we should only define the action when it has a non-#f > value. That way we can distinguish between services that have a useful > reload/reconfigure/upgrade action and those that don=E2=80=99t; in the la= tter > case, we simply use =E2=80=98restart=E2=80=99 when upgrading. > > Regarding nginx: > > + (stop (nginx-action "-s" "stop")) > + (reload (nginx-action "-s" "reload")))))))) > > Is this of any use in practice? The nginx command line is something > like: > > /gnu/store/74kz9m850ycxpzkg6dvn9wbd3xjkwwrb-nginx-1.12.0/sbin/nginx -c = /gnu/store/5w11ahw113fndvab3xmwcjzs2rw56sbh-nginx-config/bayfront.conf -p /= var/run/nginx > > and the configuration file in /gnu/store is immutable, so =E2=80=9Cnginx = -s > reload=E2=80=9D does nothing. If the action took an argument, we could d= o: > > herd reconfigure nginx /gnu/store/=E2=80=A6-new-config.conf > > which would translate to: > > nginx -s reload -c /gnu/store/=E2=80=A6-new-config.conf FWIW, with the patch at , adding such actions becomes easy (it=E2=80=99s a generalization of what you did in this patch series.) Ludo=E2=80=99.