all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Streit <simon@netpanic.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: Felix Lechner via <help-guix@gnu.org>,
	Felix Lechner <felix.lechner@lease-up.com>
Subject: Re: Mcron jobs using with-mail-out
Date: Mon, 05 Aug 2024 10:29:53 +0200	[thread overview]
Message-ID: <ygu34njv0ce.fsf@milk> (raw)
In-Reply-To: <87a5xtgsaq.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 24 May 2023 20:37:17 -0400")

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


  reply	other threads:[~2024-08-05  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-08-05 22:47     ` Felix Lechner via
2024-08-06 12:35       ` Simon Streit
2024-08-08 12:10       ` Simon Streit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ygu34njv0ce.fsf@milk \
    --to=simon@netpanic.org \
    --cc=felix.lechner@lease-up.com \
    --cc=help-guix@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.