* Mcron jobs using with-mail-out
@ 2023-05-21 20:36 Felix Lechner via
2023-05-25 0:37 ` Maxim Cournoyer
0 siblings, 1 reply; 6+ messages in thread
From: Felix Lechner via @ 2023-05-21 20:36 UTC (permalink / raw)
To: help-guix
Hi,
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!
Kind regards
Felix
[1] https://www.gnu.org/software/mcron/manual/mcron.html#index-with_002dmail_002dout
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mcron jobs using with-mail-out
2023-05-21 20:36 Mcron jobs using with-mail-out Felix Lechner via
@ 2023-05-25 0:37 ` Maxim Cournoyer
2024-08-05 8:29 ` Simon Streit
0 siblings, 1 reply; 6+ messages in thread
From: Maxim Cournoyer @ 2023-05-25 0:37 UTC (permalink / raw)
To: Felix Lechner via; +Cc: Felix Lechner
Hi Felix,
Felix Lechner via <help-guix@gnu.org> writes:
> Hi,
>
> 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.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mcron jobs using with-mail-out
2023-05-25 0:37 ` Maxim Cournoyer
@ 2024-08-05 8:29 ` Simon Streit
2024-08-05 22:47 ` Felix Lechner via
0 siblings, 1 reply; 6+ messages in thread
From: Simon Streit @ 2024-08-05 8:29 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: Felix Lechner via, Felix Lechner
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mcron jobs using with-mail-out
2024-08-05 8:29 ` Simon Streit
@ 2024-08-05 22:47 ` Felix Lechner via
2024-08-06 12:35 ` Simon Streit
2024-08-08 12:10 ` Simon Streit
0 siblings, 2 replies; 6+ messages in thread
From: Felix Lechner via @ 2024-08-05 22:47 UTC (permalink / raw)
To: Simon Streit, Maxim Cournoyer; +Cc: Felix Lechner via
Hi Simon,
On Mon, Aug 05 2024, Simon Streit wrote:
> (setenv "PATH"
> (string-append (getenv "PATH")
> ":/run/setuid-programs/"))
Thanks for that!
Do you provide a 'sendmail' executable in your system profile? If so,
should the system PATH include "/run/setuid-programs"?
Kind regards
Felix
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mcron jobs using with-mail-out
2024-08-05 22:47 ` Felix Lechner via
@ 2024-08-06 12:35 ` Simon Streit
2024-08-08 12:10 ` Simon Streit
1 sibling, 0 replies; 6+ messages in thread
From: Simon Streit @ 2024-08-06 12:35 UTC (permalink / raw)
To: Felix Lechner; +Cc: Maxim Cournoyer, Felix Lechner via
Hi Felix,
Felix Lechner <felix.lechner@lease-up.com> writes:
> Do you provide a 'sendmail' executable in your system profile? If so,
> should the system PATH include "/run/setuid-programs"?
I haven OpenSMTPd running as a service and have provided the packet
through the system profile. But /run/setuid-programs is not available
for mcron. Should it be? And if, how can I change that?
Kind regards,
--
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mcron jobs using with-mail-out
2024-08-05 22:47 ` Felix Lechner via
2024-08-06 12:35 ` Simon Streit
@ 2024-08-08 12:10 ` Simon Streit
1 sibling, 0 replies; 6+ messages in thread
From: Simon Streit @ 2024-08-08 12:10 UTC (permalink / raw)
To: Felix Lechner; +Cc: Maxim Cournoyer, Felix Lechner via
Felix Lechner <felix.lechner@lease-up.com> writes:
> Do you provide a 'sendmail' executable in your system profile? If so,
> should the system PATH include "/run/setuid-programs"?
I understand your question now. Please disregard my previous message.
Sendmail is available through /run/current-system/profile/sbin and
/run/setuid-programs/sendmail. Both are provided by OpenSMTPd. I don't
have sendmail in my user profile, and am trying to get on with mailutils
and OpenSMTPd only for the time being. I have no need for msmtpd yet.
Mcron's service PATH contains only /run/current-system/profile/bin and
thus can't find sendmail.
If I use my previous job example and leave (setenv ...) out, I get the
following error:
--8<---------------cut here---------------start------------->8---
2024-08-08 12:17:00 19819 /gnu/store/ir80y6y5g4w1qf2fcqm71lv8rh2gppwq-setuid-sans.scm: running...
2024-08-08 12:17:00 19819 /gnu/store/ir80y6y5g4w1qf2fcqm71lv8rh2gppwq-setuid-sans.scm: completed in 0.090s
2024-08-08 12:17:00 19819 /gnu/store/ir80y6y5g4w1qf2fcqm71lv8rh2gppwq-setuid-sans.scm: /gnu/store/fl3l5wx8qynjrvx5lilz6c38hb77cf36-bash-minimal-5.1.16/bin/bash: line 1: sendmail: command not found
--8<---------------cut here---------------end--------------->8---
This is slowly giving me a slight headache. Should mcron not know
about sbin, and maybe more so about setuid binaries?
The PATH in gnu/services/mcron.scm is defined a follows:
--8<---------------cut here---------------start------------->8---
#:environment-variables
(cons* "GUILE_AUTO_COMPILE=0"
"PATH=/run/current-system/profile/bin"
(remove (cut string-prefix? "PATH=" <>)
(environ)))
--8<---------------cut here---------------end--------------->8---
This applies generally. Is that not too limiting?
Kind regards
--
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-08-08 12:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-21 20:36 Mcron jobs using with-mail-out Felix Lechner via
2023-05-25 0:37 ` Maxim Cournoyer
2024-08-05 8:29 ` Simon Streit
2024-08-05 22:47 ` Felix Lechner via
2024-08-06 12:35 ` Simon Streit
2024-08-08 12:10 ` Simon Streit
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).