From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: One-shot Shepherd services Date: Mon, 29 Apr 2019 20:33:09 -0700 Message-ID: <87h8agyxoq.fsf@gmail.com> References: <87ftqfngda.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:52661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLJW9-0003f7-Tz for guix-devel@gnu.org; Mon, 29 Apr 2019 23:33:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLJW8-0004BY-FS for guix-devel@gnu.org; Mon, 29 Apr 2019 23:33:17 -0400 In-Reply-To: <87ftqfngda.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 18 Apr 2019 23:38:41 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Today I added support for =E2=80=9Cone-shot=E2=80=9D services in the Shep= herd: > > https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=3Dc121eedfff7= a50feddcf08e173d2b0dd807e8804 > > One-shot services start, perform a short action, and are immediately > marked as =E2=80=9Cstopped.=E2=80=9D (systemd has something similar: > .) > > The use case is initialization or cleanup actions like the =E2=80=98user-= homes=E2=80=99 > service. So far =E2=80=98user-homes=E2=80=99 is a regular service whose = =E2=80=98start=E2=80=99 method > always fails; as a result, we always see this message: > > Service user-homes could not be started. > > From there on, we=E2=80=99ll be able to mark this service as one-shot (pa= tch > below), and thus shepherd will notice that it successfully started (or > not) and yet mark it as stopped, which was always the intent. > > There are other cases where this could be useful. For instance, we > could turn service activation snippets into one-shot services. > > Since this augments the Shepherd API, I plan to release it as 0.6.0 > in time for Guix 1.0. It contains other rather minor changes compared > to 0.5.0. This seems like a good change. At first I was a little confused about why we would ever want to use a one-shot shepherd service instead of an activation snippet, but after reviewing the account-shepherd-service, I think I understand. It seems that we make it a one-shot shepherd service instead of an activation snippet so that we can take advantage of shepherd's service dependency management. In the case of account-shepherd-service, it looks like we made it a shepherd service to ensure that it would run after 'file-systems' is up. This makes sense, since it could be a little awkward to try to ensure proper execution order by extending the activation service, and even if we did that, it would duplicate the dependency management logic that shepherd gives us already. So yeah, it makes sense to me. =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlzHwfUACgkQ3UCaFdgi Rp0OGA/8DcnQ9KPp5H/h0/rYD/hQRPpWME26QHV529XBYf6pml4sVRA7GsUGdPw0 USzYAFiCIXHXhpxonMQM32i/By9CgTtVBb2/vnyCYpOxXlDVY4Sv6Ii/fqwj9nFS UbLQsthJ5wETgllCnz8Wm23E8qVAmUHnpU8SMpk86no7kckrdNVMKhAGl6wtK2W+ F7/3JIIrbkwH3sUXwHzw5RWS3zROgsmOztIvpOgB9/QZOiKZO0uSErVfHMPqke1f g7XfRRBCrLzx/hFHm1uVmtEss9CoKlP0rUhV3D10uRZ+04hzfqyzA4MdXAtAcE4/ J8qlOmIFFh/ywXvPsu0KNcCWBVZNtkbhrauJRqiL9GtJVDMk5bWWbQuVqOQQWh5O iY75tkCWzG6a4Y2kA9SmdWtu7xoaHRNGxfC08R3gOCJZypJDTD4iDXMaZKABxVec Gz6i46PMrm5hyoPZZljqE6Pv0wBUqjE1+1lq5zyh9nB5pMpBUwB3lPVpN/bOK+Hb tK5LG8xcjXk15O0WDbJyDNyQQ+2cknhjxaOprJMP/0zffS7tzTPOhCqw41rxY9aN IXa4fKKbEYSGjHhMtcT49gV/DXCOM8tovceCxbKDhAiT8O8MrS2c/BB/paWaSM40 Rainsbl8m1vPfD70qHzv6/lo+iQ2E6IKaUyScmkXghv1IIfAlwI= =sL/W -----END PGP SIGNATURE----- --=-=-=--