[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mcron jobs using with-mail-out
From: |
Simon Streit |
Subject: |
Re: Mcron jobs using with-mail-out |
Date: |
Mon, 05 Aug 2024 10:29:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello,
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
> Felix Lechner via <help-guix@gnu.org> writes:
>>
>> Does anyone have a working job specification for Mcron that uses
>> "with-mail-out"? [1] I have some trouble providing (mcron redirect)
>> inside the gexp. Thanks!
>
> Sorry, I don't, but I'd be interested in a concrete example as well.
I figured out a procedure for my home environment:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages guile-xyz)) ;to load mcron redirect
#~(job
'(next-minute)
#$(program-file
"ls.scm"
#~(begin
(use-modules (mcron redirect))
(setenv "PATH" (string-append (getenv "PATH")
":/run/setuid-programs/"))
(with-mail-out (lambda ()
(system (string-append #$coreutils
"/bin/ls")))
"user@localhost"))))
--8<---------------cut here---------------end--------------->8---
It looks a slightly different when applying this job to a system wide
declaration:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages guile-xyz)) ;to load mcron redirect
#~(job
'(next-minute)
#$(program-file
"ls.scm"
(with-extensions
(list mcron)
#~(begin
(use-modules (mcron redirect))
(setenv "PATH"
(string-append (getenv "PATH")
":/run/setuid-programs/"))
(with-mail-out (lambda ()
(system (string-append #$coreutils
"/bin/ls"))))))))
--8<---------------cut here---------------end--------------->8---
The action has to have its PATH extended, otherwise it fails to find
sendmail. With this I have mcron sending mail to me.
The documentation of mcron does not state that the user name is optional.
Have a nice day,
--
Simon
- Re: Mcron jobs using with-mail-out,
Simon Streit <=