Hello! The Guix manual recommends to use shepherd-timers for periodic jobs, but 
it only gives examples for jobs given by strings that are fed to bash, not 
other guile-functions. but the documentation of shepherd-timer only specifies 
that the provided command should be "a list-valued gexp". So I thought that it 
should be possible to run a Guile-function as well. So I wrote a timer:

(define battery-timer
(shepherd-timer '(battery)
"0,10,20,30,40,50 * * * *"
#~((ahp-notify-when-battery-low))))

where ahp-notify-when-battery-low is the function I wrote to tell me when my 
battery is low. But if I put reconfigure my system with

(simple-service 'my-timers
shepherd-root-service-type
(list battery-timer))

and trigger the battery-timer, shepherd gets stuck and I can't even finish 
reconfiguring my system if I try because shepherd won't respond. I tried 
similarly with a simpler test-timer, but got the same result. The 
shepherd-manual specifies in the make-timer-constructor that

"ACTION
may be either a command (returned by ‘command’) or a thunk; in the
latter case, the thunk must be suspendable or it could block the
whole shepherd process."

but this is the only place in that manual that the word "thunk" appears, I 
don't know what it is.
So is it even possible to have timers that run Guile-functions, and if so, what 
is the correct syntax for that? It would be really nice if an example of that 
were in the manual. There is a more involved example for mcron, but I'm not 
sure if it also applies to shepherd-timers and since I have to reboot each time 
this doesn't work I'm reluctant to try.

Sent with [Proton Mail](https://proton.me/mail/home) secure email.

Reply via email to