From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: Re: [PATCH] write the daemon's pid to a file.el Date: Sun, 8 Dec 2013 17:06:36 +0100 Message-ID: <20131208160636.GA17431@intra> References: <20131208111345.GA5130@intra> <87zjobz777.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vpgsf-0001HP-11 for guix-devel@gnu.org; Sun, 08 Dec 2013 11:06:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpgsZ-0004RH-OH for guix-devel@gnu.org; Sun, 08 Dec 2013 11:06:52 -0500 Content-Disposition: inline In-Reply-To: <87zjobz777.fsf@gnu.org> 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?iso-8859-1?Q?Court=E8s?= Cc: guix-devel@gnu.org --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Debian uses a script and a program start-stop-daemon. FRom the man page: Note: unless --pidfile is specified, start-stop-daemon behaves simi= lar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process n= ame, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processe= s will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have= long-lived children which need to live through a --stop, you must specify a pidfile. Of course, one can get the pid by doing guix-daemon --blah-blah &=20 pid=3D$! But the problem here is that the & means you never know when the daemon has= actually started, which leads to race conditions. Again, there are tricks to work around tha= t, but having the daemon=20 write its own pid makes it a lot easier. J' On Sun, Dec 08, 2013 at 04:35:40PM +0100, Ludovic Court=C3=A8s wrote: John Darrington skribis: =20 > I don't know what you will think of this patch. But I found that it= makes=20 > running guix under debian a whole lot easier. I suspect the same wi= ll be > true for many other OSes too. =20 How does it help exactly? On GNU, it=E2=80=99s started by dmd, which = knows its PID. I=E2=80=99d expect it to be the same with other init systems, no? =20 Thanks, Ludo=E2=80=99. --=20 PGP Public key ID: 1024D/2DE827B3=20 fingerprint =3D 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlKkmQwACgkQimdxnC3oJ7PXrQCdEX3v5BxT6B3bagxoPkmREjlu k2EAn2HJOA/m3NrCsUL7ZHab7RQPJ7N5 =SS0R -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--