From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8va7-00051h-Ty for guix-patches@gnu.org; Thu, 11 May 2017 17:25:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8va2-0001H8-EN for guix-patches@gnu.org; Thu, 11 May 2017 17:25:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36542) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d8va2-0001Gy-AS for guix-patches@gnu.org; Thu, 11 May 2017 17:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d8va2-0007TI-4V for guix-patches@gnu.org; Thu, 11 May 2017 17:25:02 -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> Date: Thu, 11 May 2017 23:24:04 +0200 In-Reply-To: <86vapa6nyi.fsf@gmail.com> (Mathieu Othacehe's message of "Tue, 09 May 2017 17:37:25 +0200") Message-ID: <87vap7kryj.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: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur , 26830@debbugs.gnu.org Hello! Mathieu Othacehe skribis: >> Services do not have to implement 'reload' and if, say, foo-daemon >> doesn't implement it, 'herd reload foo-daemon' will return 1 and display >> a message saying that foo-deamon does not have an action 'reload'. >> That's the reason of the #f default value. >> >> WDYT? > > Your whole serie LGTM for me ! Same here, really happy to see this addressed! > I have just one small concern, there is a already a "reload" action on > shepherd root service. Right, but that=E2=80=99s just for =E2=80=98root=E2=80=99, not for the othe= r services. However, I think =E2=80=98reload=E2=80=99 might be confusing since in fact = it doesn=E2=80=99t load Scheme code, contrary to what =E2=80=9Cherd load root foo.scm=E2=80=9D= does (maybe that=E2=80=99s what you meant?). In fact it=E2=80=99s closer to what =E2= =80=9Cherd restart foo=E2=80=9D does. What about changing the name to =E2=80=98reconfigure=E2=80=99 or =E2=80=98u= pgrade=E2=80=99 to avoid the confusion? 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 i= t is defined. That will be awesome. Some comments: + #:actions (make-actions + (reload + "Reload the service's configuration file= s." + #$(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 latt= er 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 /g= nu/store/5w11ahw113fndvab3xmwcjzs2rw56sbh-nginx-config/bayfront.conf -p /va= r/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 do: 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 Probably our best option. Otherwise, I think we=E2=80=99d have to move the config to a fixed location= , say /etc/nginx, for =E2=80=9Cnginx -s reload=E2=80=9D to have any effect. Howe= ver I don=E2=80=99t quite like the use of /etc. Thoughts? Does Dovecot have the same problem? Thank you! Ludo=E2=80=99.