Hello,
Maxim Cournoyer <[email protected]> writes:
>
> Felix Lechner via <[email protected]> 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