all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Hipólita Yarona" <hipyarona@gmail.com>
To: Csepp <raingloom@riseup.net>
Cc: Ben Weinstein-Raun <root@benwr.net>, help-guix@gnu.org
Subject: Re: Shepherd user services that run on startup?
Date: Thu, 28 Dec 2023 23:56:27 -0300	[thread overview]
Message-ID: <CAPyh5WSx+m98+BGMEY-5M4e5Qyi9LZsBWvcYOnWcAYq3kjoFHw@mail.gmail.com> (raw)
In-Reply-To: <87r0j5nbba.fsf@riseup.net>

On Thu, Dec 28, 2023 at 8:43 PM Csepp <raingloom@riseup.net> wrote:
> Ben Weinstein-Raun <root@benwr.net> writes:
>
> > Hello! I'm fairly new to using Guix System, and I have a lot of
> > questions.

So am I, so do I.

> > One is: Is it possible to run a shepherd user service at system
> > start, rather than at login?
> >
> > My guess is that this is at least possible, by defining a
> > system-level service that starts a shepherd for each user. Would
> > that work?
> >
> > Anyone have tips on how to go about building this, if so?

I'll let others reply on behalf of Guix and Shepherd.  What I'll add is
a reinforcement of your idea, but which drifts apart from the Guix
system.  You can use Daniel J. Bernstein's daemontools

  http://cr.yp.to/daemontools.html,

which is already packaged in Guix --- guix install daemontools.  You can
write a service for Shepherd to start daemontool's svscan and now you
can manage all your services outside Shepherd, including user's services
--- so long as you complement the system in one small way.

With svscan starting at boot, letting users run their own services at
boot as well is a matter of writing a program with the setuid-bit so
that it is able to create symbolic links in the directory monitored by
svscan (say, /service) --- enabling the user's service to be managed by
svscan.  That would accomplish what you ask.

Many system administrators will not let users create as many services as
they want.  You need to answer these questions.  Say you'd like to allow
users to have up to a few services --- tprogram-idea above could control
that by counting how many the users has already used.

Here's what the user would go through to install his service:

  $ mkdir ~/my-service
  $ emacs ~/my-service/run
  $ chmod 0755 ~/my-service/run

Say the program-idea above is called ``create-service''.  Then

  $ create-service user-x-service-1 ~/my-service

creates a symbolic link

 /service/user-x-service-1 --> /home/x/my-service

The daemontool's svscan program will start the run script within a few
seconds.  From then on, the user can use daemontools to monitor his
service at ~/my-service.


  reply	other threads:[~2023-12-30  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 21:42 Shepherd user services that run on startup? Ben Weinstein-Raun
2023-12-28 23:42 ` Csepp
2023-12-29  2:56   ` Hipólita Yarona [this message]
2024-01-01 22:04 ` Ben Weinstein-Raun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPyh5WSx+m98+BGMEY-5M4e5Qyi9LZsBWvcYOnWcAYq3kjoFHw@mail.gmail.com \
    --to=hipyarona@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=raingloom@riseup.net \
    --cc=root@benwr.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.