unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to add the timer-trigger-action to a shepherd service?
@ 2024-12-16 22:53 Tomas Volf
  2024-12-16 23:36 ` Felix Lechner via
  2024-12-16 23:43 ` Jake
  0 siblings, 2 replies; 5+ messages in thread
From: Tomas Volf @ 2024-12-16 22:53 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]


Hello,

I am trying to use the new shepherd timers in my guix configuration.  I
got it working with some help on IRC, except I cannot figure out how to
configure the extra action.  Shepherd's manual gives this example:

--8<---------------cut here---------------start------------->8---
     (define updatedb
       (service
         '(updatedb)
         #:start (make-timer-constructor
                   ;; Fire at midnight and noon everyday.
                   (calendar-event #:hours '(0 12) #:minutes (0))
                   (command '("/usr/bin/updatedb"
                              "--prunepaths=/tmp")))
         #:stop (make-timer-destructor)
         #:actions (list timer-trigger-action)))
--8<---------------cut here---------------end--------------->8---

However I cannot figure out what to put into the (actions) field of the
shepherd-service record.  Documentation says it should be instance of
shepherd-action, however I have no idea how to turn the
timer-trigger-action into it.  Any suggestions?

Thanks,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add the timer-trigger-action to a shepherd service?
  2024-12-16 22:53 How to add the timer-trigger-action to a shepherd service? Tomas Volf
@ 2024-12-16 23:36 ` Felix Lechner via
  2024-12-18 14:05   ` Tomas Volf
  2024-12-16 23:43 ` Jake
  1 sibling, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2024-12-16 23:36 UTC (permalink / raw)
  To: help-guix

Hi Tomas,

On Mon, Dec 16 2024, Tomas Volf wrote:

> what to put into the (actions) field

Please try this:

   (actions
    (list (shepherd-action
           (name 'trigger)
           (documentation "Trigger the action associated with this timer.")
           (procedure #~(identity trigger-timer)))))

You can see my full timer definitions here. [1]

Kind regards
Felix

[1] https://codeberg.org/lechner/system-config/src/commit/4335818ba8da818f21810b5b402db51c77d3b344/host/wallace-server/operating-system.scm#L660-L664


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add the timer-trigger-action to a shepherd service?
  2024-12-16 22:53 How to add the timer-trigger-action to a shepherd service? Tomas Volf
  2024-12-16 23:36 ` Felix Lechner via
@ 2024-12-16 23:43 ` Jake
  2024-12-18 14:06   ` Tomas Volf
  1 sibling, 1 reply; 5+ messages in thread
From: Jake @ 2024-12-16 23:43 UTC (permalink / raw)
  To: help-guix

Hi Tomas

I got the snippet below from the patch series
https://issues.guix.gnu.org/74860

   (actions (list (shepherd-action
                   (name 'trigger)
                   (documentation "Trigger something.")
                   (procedure #~trigger-timer))))

Cheers
Jake



On Mon, Dec 16, 2024 at 10:54 PM Tomas Volf <~@wolfsden.cz> wrote:

>
> Hello,
>
> I am trying to use the new shepherd timers in my guix configuration.  I
> got it working with some help on IRC, except I cannot figure out how to
> configure the extra action.  Shepherd's manual gives this example:
>
> --8<---------------cut here---------------start------------->8---
>      (define updatedb
>        (service
>          '(updatedb)
>          #:start (make-timer-constructor
>                    ;; Fire at midnight and noon everyday.
>                    (calendar-event #:hours '(0 12) #:minutes (0))
>                    (command '("/usr/bin/updatedb"
>                               "--prunepaths=/tmp")))
>          #:stop (make-timer-destructor)
>          #:actions (list timer-trigger-action)))
> --8<---------------cut here---------------end--------------->8---
>
> However I cannot figure out what to put into the (actions) field of the
> shepherd-service record.  Documentation says it should be instance of
> shepherd-action, however I have no idea how to turn the
> timer-trigger-action into it.  Any suggestions?
>
> Thanks,
> Tomas
>
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add the timer-trigger-action to a shepherd service?
  2024-12-16 23:36 ` Felix Lechner via
@ 2024-12-18 14:05   ` Tomas Volf
  0 siblings, 0 replies; 5+ messages in thread
From: Tomas Volf @ 2024-12-18 14:05 UTC (permalink / raw)
  To: Felix Lechner via; +Cc: Felix Lechner

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

Hello,

Felix Lechner via <help-guix@gnu.org> writes:

> Hi Tomas,
>
> On Mon, Dec 16 2024, Tomas Volf wrote:
>
>> what to put into the (actions) field
>
> Please try this:
>
>    (actions
>     (list (shepherd-action
>            (name 'trigger)
>            (documentation "Trigger the action associated with this timer.")
>            (procedure #~(identity trigger-timer)))))

I see, so basically from shepherd use just the procedure, and craft the
rest of the action by hand.  Thank you for the advice. :)

>
> You can see my full timer definitions here. [1]
>
> Kind regards
> Felix
>
> [1] https://codeberg.org/lechner/system-config/src/commit/4335818ba8da818f21810b5b402db51c77d3b344/host/wallace-server/operating-system.scm#L660-L664
>

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add the timer-trigger-action to a shepherd service?
  2024-12-16 23:43 ` Jake
@ 2024-12-18 14:06   ` Tomas Volf
  0 siblings, 0 replies; 5+ messages in thread
From: Tomas Volf @ 2024-12-18 14:06 UTC (permalink / raw)
  To: Jake; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

Jake <jforst.mailman@gmail.com> writes:

> Hi Tomas
>
> I got the snippet below from the patch series
> https://issues.guix.gnu.org/74860
>
>    (actions (list (shepherd-action
>                    (name 'trigger)
>                    (documentation "Trigger something.")
>                    (procedure #~trigger-timer))))

Oh, this seems a bit more elegant that the version with identity, thanks
for the suggestion.

>
> Cheers
> Jake
>
>
>
> On Mon, Dec 16, 2024 at 10:54 PM Tomas Volf <~@wolfsden.cz> wrote:
>
>>
>> Hello,
>>
>> I am trying to use the new shepherd timers in my guix configuration.  I
>> got it working with some help on IRC, except I cannot figure out how to
>> configure the extra action.  Shepherd's manual gives this example:
>>
>> --8<---------------cut here---------------start------------->8---
>>      (define updatedb
>>        (service
>>          '(updatedb)
>>          #:start (make-timer-constructor
>>                    ;; Fire at midnight and noon everyday.
>>                    (calendar-event #:hours '(0 12) #:minutes (0))
>>                    (command '("/usr/bin/updatedb"
>>                               "--prunepaths=/tmp")))
>>          #:stop (make-timer-destructor)
>>          #:actions (list timer-trigger-action)))
>> --8<---------------cut here---------------end--------------->8---
>>
>> However I cannot figure out what to put into the (actions) field of the
>> shepherd-service record.  Documentation says it should be instance of
>> shepherd-action, however I have no idea how to turn the
>> timer-trigger-action into it.  Any suggestions?
>>
>> Thanks,
>> Tomas
>>
>> --
>> There are only two hard things in Computer Science:
>> cache invalidation, naming things and off-by-one errors.
>>

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-18 14:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 22:53 How to add the timer-trigger-action to a shepherd service? Tomas Volf
2024-12-16 23:36 ` Felix Lechner via
2024-12-18 14:05   ` Tomas Volf
2024-12-16 23:43 ` Jake
2024-12-18 14:06   ` Tomas Volf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).