all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Adam Kandur <kefironpremise@gmail.com>, guix-devel@gnu.org
Subject: Re: trying to write my own herd service
Date: Sat, 05 Nov 2022 10:02:33 +0100	[thread overview]
Message-ID: <bc84b6284ad3a8091804235eaedc26073c3e9588.camel@gmail.com> (raw)
In-Reply-To: <CAJpP0NODiXkB3G0gngbfOQ6WqwPEPu-q9GmT_aPOyLmjCEHqfQ@mail.gmail.com>

Am Samstag, dem 05.11.2022 um 02:21 +0300 schrieb Adam Kandur:
> Hi guix!
> I tried to write my own herd service, that's what i did
> ```
> (define (my-daemon-shepherd-service _)
>   (list (shepherd-service
>          (documentation "")
>          (provision '(go-github-com-KefirTheAutomator-daemon))
>          (requirement '(networking))
>          (start #~(make-forkexec-constructor
>                    (list
>                     (string-append
> #$go-github-com-KefirTheAutomator-daemon "/bin/daemon")
>                     " -pidFile=/var/run/my-daemon.pid"
>                     " -logFile=/var/log/my-daemon.log")))
>          (stop #~(make-kill-destructor)))))
> 
> (define my-daemon-service-type
>   (service-type (name 'my-daemon)
>                 (extensions
>                  (list (service-extension shepherd-root-service-type
>                                           my-daemon-shepherd-
> service)))
>                 (default-value #f)
>                 (description "")))
> ```
First things first, writing your own shepherd service from Guix adds a
layer of difficulty: Not only do you need to understand shepherd, you
also need to understand how Guix glues things together.  I would
recommend starting with a simple hand-written service, because that
makes it easier to invoke shepherd as a user and inspect its output.

> (go-github-com-KefirTheAutomator-daemon is my dummy daemon that just
> creates a process and writes to it's log file).
> 
> This was pulled from my channel, but when I am trying to start the
> services, it turns of and disables
> ```
> user@workstation ~$ sudo herd status go-github-com-KefirTheAutomator-
> daemon
> Status of go-github-com-KefirTheAutomator-daemon:
>   It is stopped.
>   It is disabled.
>   Provides (go-github-com-KefirTheAutomator-daemon).
>   Requires (networking).
>   Conflicts with ().
>   Will be respawned.
>   Last respawned on Sat Nov 05 02:14:33+0300 2022.
> 
> ```
> 
> Can anyone help me to find out what is wrong, I didn't find any
> recommendations on writing herd services?
Your process probably dies too often, thus causing shepherd to disable
it.  If it is intended to be a one-shot service, mark it as such.  If
not, check there are unfulfilled requirements.

Cheers

  reply	other threads:[~2022-11-05  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 23:21 trying to write my own herd service Adam Kandur
2022-11-05  9:02 ` Liliana Marie Prikler [this message]
2022-11-05 13:26   ` EuAndreh

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=bc84b6284ad3a8091804235eaedc26073c3e9588.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=kefironpremise@gmail.com \
    /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.