[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shepherd timers
From: |
Ludovic Courtès |
Subject: |
Re: Shepherd timers |
Date: |
Thu, 28 Mar 2024 23:32:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello!
Felix Lechner <felix.lechner@lease-up.com> skribis:
> The simple example worked great, but my more complex attempt to convert
> an mcron job seems to have failed. Do you know why?
>
> (define (rsync-debbugs-shepherd-service config)
> (shepherd-service
> (provision '(rsync-debbugs))
Nice use case. :-)
>> 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
So ‘herd status rsync-debbugs’ exited after 160s without printing
anything? What does /var/log/messages say?
I tried something similar on my laptop but it seems to work.
Namely, I have:
--8<---------------cut here---------------start------------->8---
(use-modules (shepherd service timer))
(define gc-timer
(service
'(gc)
#:start (make-timer-constructor
(calendar-event #:minutes '(0))
(command '("/run/current-system/profile/bin/guix" "gc" "-F2G")
#:user "ludo"))
#:stop (make-timer-destructor)
#:actions (list timer-trigger-action)))
(register-services (list gc-timer))
--8<---------------cut here---------------end--------------->8---
And then I do:
sudo herd load root that-file.scm
I start, restart, reload, restart, etc. and it seems fine.
Thanks for trying it out!
Ludo’.