all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Lechner via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>, "Guix Devel" <guix-devel@gnu.org>
Subject: Re: Shepherd timers
Date: Mon, 25 Mar 2024 15:47:51 -0700	[thread overview]
Message-ID: <877chq3p48.fsf@lease-up.com> (raw)
In-Reply-To: <87jzlrpbsr.fsf@gnu.org>

Hi Ludo',

On Sun, Mar 24 2024, Ludovic Courtès wrote:

> I pushed to the ‘devel’ branch of the Shepherd a new module that
> implements “timers”

Wow, that's super exciting!  I promptly reconfigured my channels to pull
in the Shepherd branch.  (Anyone who wants to do the same, please reply
here for info.)  For me, Shepherd timers will allow the temporary
stoppage of individual cron jobs.

For a server that can make debugging much easier.

> (command '("sh" "-c" "echo Hi from $PWD.; sleep 20; echo done")))

The simple example worked great, but my more complex attempt to convert
an mcron job seems to have failed.  Do you know why?

--8<---------------cut here---------------start------------->8---
(define (rsync-debbugs-shepherd-service config)
  (shepherd-service
   (provision '(rsync-debbugs))
   (requirement '(networking file-systems))
   (modules '((shepherd service timer)
              (srfi srfi-1)))
   (start #~(make-timer-constructor
             (calendar-event #:minutes '(iota 12 3 5))
             (command `(,#$(file-append rsync "/bin/rsync")
                        "-4"
                        "--delete"
                        "-av"
                        "--password-file=/root/secrets/var-lib-debbugs.rsync"
                        "debbugs-var@debbugs.gnu.org::var-lib-debbugs"
                        "/var/lib/debbugs/"))))
   (stop #~(make-timer-destructor))
   (documentation "Timer to rsync Debbugs bug details to this machine.")))

(define rsync-debbugs-service-type
  (service-type
   (name 'rsync-debbugs)
   (description
    "Rsync Debbugs bug details to this machine.")
   (extensions
    (list
     (service-extension shepherd-root-service-type
                        (compose list rsync-debbugs-shepherd-service))))
   (default-value #f)))
--8<---------------cut here---------------end--------------->8---

and then later

--8<---------------cut here---------------start------------->8---
            (service rsync-debbugs-service-type)
--8<---------------cut here---------------end--------------->8---

At the bottom of this message is the log from my Eshell session.  The
first funny thing was that the old timer info still showed in 'herd
status'.  That's probably because some services are not reloaded
automatically. I can never figure out which are and which aren't.

More important, however, I was unable to get status information from the
more complex timer service.  What did I do wrong, please?

Thanks for this excellent work, especially in calender-event.  The
Shepherd is a super cute piece of software!

Kind regards
Felix

* * *

guix deploy: successfully deployed wallace-server
#[STATUS] End time 2024-03-25 14:02:35, duration 86.932s
[~]
> cd /ssh:root@wallace-server.local:/srv/patchwise
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
Status of rsync-debbugs:
  It is running since 13:44:40 (19 minutes ago).
  Timed service.
  Periodically running: sh -c "echo Hi from $PWD.; sleep 20; echo done".
  It is enabled.
  Provides (rsync-debbugs).
  Requires (networking file-systems).
  Will be respawned.

Recent runs:
  2024-03-25 14:03:06 Process exited with code 1.
  2024-03-25 14:03:14 Process exited with code 1.
  2024-03-25 14:03:21 Process exited with code 1.
  2024-03-25 14:03:29 Process exited with code 1.
  2024-03-25 14:03:44 Process exited with code 1.

Recent messages:
  2024-03-25 14:03:44 exec of "sh" failed: No such file or directory
  2024-03-25 14:03:44 
  2024-03-25 14:03:44 Some deprecated features have been used.  Set the environment
  2024-03-25 14:03:44 variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
  2024-03-25 14:03:44 program to get more information.  Set it to "no" to suppress
  2024-03-25 14:03:44 this message.

Upcoming timer alarms:
  14:04:00 (in 15 seconds)
  14:04:07 (in 22 seconds)
  14:04:15 (in 30 seconds)
  14:04:22 (in 37 seconds)
  14:04:30 (in 45 seconds)
#[STATUS] End time 2024-03-25 14:03:45, duration 1.430s
(root@wallace-server.local)[/s/srv/patchwise]
> herd restart rsync-debbugs
Service user-homes has been started.
Starting service rsync-debbugs...
Service rsync-debbugs started.
Service rsync-debbugs running with value #<<timer> channel: #<<channel> getq: #<atomic-box 7fb467c1c990 value: (())> getq-gc-counter: #<atomic-box 7fb467c1c980 value: 42> putq: #<atomic-box 7fb467c1c960 value: (())> putq-gc-counter: #<atomic-box 7fb467c1c950 value: 42>> event: #<<calendar-event> seconds: (0) minutes: (iota 12 3 5) hours: (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) days-of-month: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) months: (1 2 3 4 5 6 7 8 9 10 11 12) days-of-week: #f> action: #<<command> arguments: ("/gnu/store/1g0gk9pcymgc0bb1dh115swakmh438p6-rsync-3.2.7/bin/rsync" "-4" "--delete" "-av" "--password-file=/root/secrets/var-lib-debbugs.rsync" "debbugs-var@debbugs.gnu.org::var-lib-debbugs" "/var/lib/debbugs/") user: #f group: #f environment-variables: ("HOME=/" "TERM=linux" "BOOT_IMAGE=/gnu/store/psn2jwyrvr8jxb1nrndxf3h7kg8vvfwa-linux-6.6.2/bzImage" "PATH=/gnu/store/2jbvnib5ar70q1vlhhngish1svqfry0j-e2fsck-static-1.46.4/sbin:/gnu/store/jlbzcgxxzhynv74ss2510b0x978srnf9-loadkeys-static-2.5.1/bin" "GUIX_LOCPATH=/gnu/store/5fmqijrs5f7vx8mc2q2pmq26yvhb74sm-glibc-utf8-locales-2.35/lib/locale") directory: "/" resource-limits: ()>>.
Service rsync-debbugs has been started.
#[STATUS] End time 2024-03-25 14:04:40, duration 1.081s
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
#[STATUS] End time 2024-03-25 14:07:41, duration 159.524s
(root@wallace-server.local)[/s/srv/patchwise]
> herd restart mcron
Service user-homes has been started.
Starting service mcron...
Service mcron started.
Service mcron running with value #<<process> id: 4171 command: ("/gnu/store/2izimf0xymk3qm35i7lsqbhpid2235ik-mcron-1.2.3/bin/mcron" "--log" "--log-format" "~1@*~a ~a: ~a~%" "/gnu/store/annwvnihjy5sghw6s05l6kzijk6rbg93-mcron-job" "/gnu/store/dx7gyb3mrfzpwrsfjfjfnicmiqz7jszw-mcron-job" "/gnu/store/knfag5iw4mqhf6lqb462p95zs3knici3-mcron-job" "/gnu/store/485wh62g950zgi2cjwh7q6rayag2p5mi-mcron-job" "/gnu/store/kxp8cd5x183zy10bd93mmvyxgm8b89q6-mcron-job" "/gnu/store/20a2d6pg5hckpsv2ap91y0sl2vdcx0jb-mcron-job" "/gnu/store/7l4cr6982gyldv8jz8lfvq8i4wcp65z6-mcron-job" "/gnu/store/srcq4hqg88s3nd22b4l3vkpg2gx03fyf-mcron-job")>.
Service mcron has been started.
#[STATUS] End time 2024-03-25 14:12:52, duration 1.333s
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
#[STATUS] End time 2024-03-25 15:18:41, duration 10.155s

 


  parent reply	other threads:[~2024-03-25 22:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24 21:20 Shepherd timers Ludovic Courtès
2024-03-25  9:14 ` raingloom
2024-03-28 22:22   ` Ludovic Courtès
2024-03-25 22:47 ` Felix Lechner via Development of GNU Guix and the GNU System distribution. [this message]
2024-03-28 22:32   ` Ludovic Courtès
2024-04-02 14:23     ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-04-10 14:45       ` Ludovic Courtès
2024-04-14 19:47         ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-04-19 14:35           ` Ludovic Courtès
2024-04-21 21:28             ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-05-01 21:58               ` Ludovic Courtès
2024-04-03  1:08 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-04-10 14:44   ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2024-03-31  3:15 Adam Faiz
2024-03-31  4:07 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-03-31  4:09 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.

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=877chq3p48.fsf@lease-up.com \
    --to=guix-devel@gnu.org \
    --cc=felix.lechner@lease-up.com \
    --cc=ludo@gnu.org \
    /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.