From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Improving Shepherd Date: Fri, 09 Feb 2018 14:22:09 +0100 Message-ID: <874lmq2t8e.fsf@gnu.org> References: <871si8bc5g.fsf@zancanaro.id.au> <877errn23f.fsf@zancanaro.id.au> <20180205170011.73780f13@scratchpost.org> 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]:41498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek8d6-0008TO-58 for guix-devel@gnu.org; Fri, 09 Feb 2018 08:22:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek8d2-0000HB-Se for guix-devel@gnu.org; Fri, 09 Feb 2018 08:22:16 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:42216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ek8d2-0000Gh-L9 for guix-devel@gnu.org; Fri, 09 Feb 2018 08:22:12 -0500 In-Reply-To: <20180205170011.73780f13@scratchpost.org> (Danny Milosavljevic's message of "Mon, 5 Feb 2018 17:00:11 +0100") 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: Danny Milosavljevic Cc: guix-devel@gnu.org, Carlo Zancanaro Hey! Danny Milosavljevic skribis: > On Mon, 05 Feb 2018 21:49:08 +1100 > Carlo Zancanaro wrote: > >> User services - Alex has already sent a patch to the list to allow=20 >> generating user services from the Guix side. The idea is to=20 >> generate a Shepherd config file, allowing a user to invoke=20 >> shepherd manually to start their services. > >>A further extension to=20 >> this would be to have something like systemd's "user sessions",=20 >> where the pid 1 Shepherd automatically starts a user's services=20 >> when they log in. > > I assume that means "starts a user's shepherd when they log in". > > elogind already emits a signal on dbus which tells you when a user logged= in > > return sd_bus_emit_signal( > u->manager->bus, > "/org/freedesktop/login1", > "org.freedesktop.login1.Manager", > new_user ? "UserNew" : "UserRemoved", > "uo", (uint32_t) u->uid, p); I think there=E2=80=99s Guile D-Bus client though. Another yak to shave=E2= =80=A6 > Also, a directory /run/user/ appears - which alternatively can be > monitored by inotify or something. > > So the system shepherd could have a shepherd service which does > > while (1) { > wait until /run/user/ appears > vfork > if child: setuid, exec user shepherd, _exit > if parent: wait until child dies > } > > We better be sure that no one else can create directories in /run/user . > > In non-pseudocode, both "wait until /run/user/ appears" and > "wait until child dies" would have to be in the same call, > maybe epoll or something. Yes, inotify (ISTR there *are* inotify bindings for Guile somewhere.) > Maybe call the service shepherd-nursery-service or something, like a star > nursery :) :-) Ludo=E2=80=99.