help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to call a local function from a mcron job?


From: EuAndreh
Subject: How to call a local function from a mcron job?
Date: Sun, 29 Nov 2020 20:58:23 -0300

Hi Guix!

I wrote a Guile function that works like a script that take no arguments
and interacts with the filesystem, something like:

  (define (my-fn)
    ...)

It is a wrapper over other functions defined in the same file, and calls
them in the right order.

Then I wanted to make this function run as a mcron job, and I tried:

  (define my-fn-job
    #(job "* * * * *"
          my-fn))

But that doesn't work. At reconfigure time, Guix complains about not
knowing the variable 'my-fn':

  Unbound variable: my-fn

I tried wrapping it in a '(with-imported-modules ...)' call, but the
code isn't in a module, but in the same file.

I guess that putting all my code from 'my-fn' and all the functions it
calls inlined in a lambda in the job definition would solve it, but it
feels wrong to me.

Is there a way to reference it from the job, without embedding all the
scheme code in the job definition?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]