Re: mcron service and PATH (was: Home service for mbsync?)

2024-02-22 Thread Felix Lechner via
Hi,

> you can find it here
> I've attached my mbsync service
> I just run mbsync as an mcron service.
> +1! I also run it using mcron.
> In my home services I have this:
> I'm doing something similar

First off, thanks for all your responses so far!

On Thu, Feb 22 2024, Emmanuel Beffara wrote:

> the command in the mcron job is called with an incomplete PATH.

Has anyone noticed a similar PATH issue with system Mcron jobs?  I have
to do this inside my Mcron jobs:

(setenv "PATH"
(string-join (list "/run/setuid-programs" (getenv "PATH")) ":"))

Otherwise, the setuid copies of my executables like 'sendmail' are not
available in Mcron jobs.

Also, while I have your attention, my fellow Mcron aficionados, please
feel free to check out this little issue. [1] There goes another
afternoon...

Kind regards
Felix

[1] https://lists.gnu.org/archive/html/bug-mcron/2023-12/msg1.html



Re: mcron service and PATH (was: Home service for mbsync?)

2024-02-22 Thread Emmanuel Beffara
Hi,

De Tanguy LE CARROUR le 22/02/2024 à 14:51:
> Quoting Emmanuel Beffara (2024-02-22 13:37:10)
> > I recently noticed an issue with that: it seems that the command in the 
> > mcron
> > job is called with an incomplete PATH.
> 
> Yes, indeed.
> 
> The "problem" was discussed, among other places, here:
> .

Ha. I did receive this thread but didn't read it enough to realize this was
actually the cause of my problem (symptom: mail was not fetched automatically
anymore, it turns out the reasons were essentially the same as in your case).

> Long story short: I decided to put (or inject) the full path in all my
> config files.

My current fix is to prefix the job command with “source ~/.profile;” and keep
the config files otherwise unchanged.

Thanks !

-- 
Emmanuel



Re: mcron service and PATH (was: Home service for mbsync?)

2024-02-22 Thread Tanguy LE CARROUR
Hi Emmanuel,


Quoting Emmanuel Beffara (2024-02-22 13:37:10)
> De Carlo Zancanaro le 22/02/2024 à 10:27:
> > On Wed, Feb 21 2024, Felix Lechner via wrote:
> > > Does anyone have an 'mbsync' home service, please? Thanks!
> > I just run mbsync as an mcron service. I have a custom script, because I
> > do some weird stuff to update my mu index afterwards, but it shouldn't
> > be hard to figure out how to call mbsync directly.
> > 
> > In my home services I have this:
> > 
> >(simple-service 'mail-update-script
> >home-mcron-service-type
> >;; Update email every five minutes.
> >(list #~(job '(next-minute '(0 5 10 15 20 25 30 35 40 45 
> > 50 55))
> > "/home/carlo/.local/bin/fetch-mail")))
> > 
> > Obviously this doesn't handle configuring mbsync, which I do outside of
> > my home configuration.
> […]
> I recently noticed an issue with that: it seems that the command in the mcron
> job is called with an incomplete PATH.

Yes, indeed.

The "problem" was discussed, among other places, here:
.

Long story short: I decided to put (or inject) the full path in all my
config files.

-- 
Tanguy



Re: Mcron jobs using with-mail-out

2023-05-24 Thread Maxim Cournoyer
Hi Felix,

Felix Lechner via  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



Re: mcron <3 offlineimap

2022-09-21 Thread Sergiu Ivanov
Hi,

zimoun  [2022-09-21T10:31:45+0200]:
> On Sat, 27 Aug 2022 at 10:45, jgart  wrote:
>
>> has anyone tried running offlineimap on a(n) (m)cron?
>
> No.  And I switched from offlineimap to isync (mbsync) for some parts.
> And to public-inbox (so Git) for other parts.

Same thing here (sans public-inbox).  I also found that isync was
considerably faster than offlineimap.

Two years ago I had the impression that offlineimap was in the process
of being abandoned, due in particular to the side note from the
maintainer here: http://www.offlineimap.org/ .  However, when I check
various Git repos today, it seems that offlineimap is still quite alive
and kicking.

-
Sergiu



Re: mcron <3 offlineimap

2022-09-21 Thread zimoun
Hi,

On Sat, 27 Aug 2022 at 10:45, jgart  wrote:

> has anyone tried running offlineimap on a(n) (m)cron?

No.  And I switched from offlineimap to isync (mbsync) for some parts.
And to public-inbox (so Git) for other parts.


Cheers,
simon



Re: mcron

2018-08-05 Thread Pierre Neidhardt
Yes, Vixie syntax is supported there too!
See "(mcron) Vixie Syntax".

But if you can grasp the Lisp syntax instead, I'd recommend you for it, it's
much more flexible.  After all, it's the sole raison-d'être of mcron with regard
to cron :)

I think your solution to "every N minute" is correct.

Cheers!
-- 
Pierre Neidhardt


signature.asc
Description: PGP signature


Re: mcron

2018-08-04 Thread Benjamin Slade
Many thanks, Pierre.

Can one also mix Vixie-style things in `~/.config/cron/` ?

It probably doesn't matter since I think I've figured out mcron native
syntax.  I was looking everywhere in "(mcron) Top" for an example of "do
X every N minutes", but finally figured out that this works (at least I
hope so):

--8<---cut here---start->8---
(job '(next-minute (range 0 60 5)) "dosomethingevery5minutes")
(job '(next-minute (range 0 60 10)) "dosomethingevery10minutes")
--8<---cut here---start->8---

--
Benjamin Slade - https://babbagefiles.xyz
  `(pgp_fp: ,(21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19))
'(sent by mu4e on Emacs running under GNU/Linux . https://gnu.org )
   `(Choose Linux ,(Choose Freedom) . https://linux.com )



Re: mcron

2018-08-04 Thread Pierre Neidhardt
No, mcron at the user-level is even simpler, simply tweak your configuration
file and start `mcron`.

Example job in ~/.config/cron/job.guile:
--8<---cut here---start->8---
(job '(next-hour (range 0 24 3)) "updatedb")
--8<---cut here---end--->8---

Once mcron is running, you can test the schedule by calling `mcron --schedule=5`
to list the 5 next scheduled jobs.

Have a look at "(mcron) Top", it's a very short read ;)

-- 
Pierre Neidhardt


signature.asc
Description: PGP signature


Re: mcron

2018-08-04 Thread Benjamin Slade
On 2018-08-04T02:44:24-0600, Pierre Neidhardt  wrote:

 > Not sure I can help much here because I personally run help cron from my user
 > session, i.e. with "mcron &" in my ".profile".  I declare the jobs in
 > "~/.config/cron/job.guile".

 > Maybe you could try that for the user-level jobs and see if it works in that 
 > condition?

Thanks, Pierre. What is the procedure for declaring jobs in
`~/.config/cron/job.guile` ? For the `/etc/config.scm` method, as far as
I understand it, the jobs need defining and then enabling/calling. Does
it work for the same for the user session cron in `~/.config/cron/job.guile` ?

thanks,
  ---Ben
-- 
Benjamin Slade - https://babbagefiles.xyz
  `(pgp_fp: ,(21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19))
'(sent by mu4e on Emacs running under GNU/Linux . https://gnu.org )
   `(Choose Linux ,(Choose Freedom) . https://linux.com )



Re: mcron

2018-08-04 Thread Pierre Neidhardt
Not sure I can help much here because I personally run help cron from my user
session, i.e. with "mcron &" in my ".profile".  I declare the jobs in
"~/.config/cron/job.guile".

Maybe you could try that for the user-level jobs and see if it works in that 
condition?

-- 
Pierre Neidhardt


signature.asc
Description: PGP signature


Re: mcron or mcron2?

2017-11-23 Thread Leo Famulari
On Thu, Nov 23, 2017 at 11:02:48AM -0600, Caleb Herbert wrote:
> On Thu, 2017-11-23 at 10:01 -0500, Leo Famulari wrote:
> > The GuixSD mcron service uses mcron2, so I think that is probably the
> > best one :)
> 
> Which is more likely to work on a foreign distro?  (Trisquel.)

I'm not sure, because I haven't tried using it in that context.

You could take a look at which version is provided by Trisquel (assuming
they offer mcron), and use that one, since it is probably the best
tested on Trisquel.


signature.asc
Description: PGP signature


Re: mcron job with cd to directory?

2017-05-17 Thread Clément Lassieur
ng0  writes:

> Ludovic Courtès transcribed 0.9K bytes:

>> Something like:
>> 
>>   #~(job '(next-hour '(4))
>>   (lambda ()
>> (chdir …)
>> (system* …)))
>> 
>> See 
>> .
>> 
>> Ludo’.
>> 
>
> Thanks! This fixed at least the respawn-death of mcron. Now I just have to
> see if it does what I want.

I have found the '--schedule' option of mcron very useful for debugging.
Maybe it'll help you to see if it does what you want.

> But it's good to know that it is that easy.



Re: mcron job with cd to directory?

2017-05-17 Thread ng0
Ludovic Courtès transcribed 0.9K bytes:
> Howdy ng0,
> 
> ng0  skribis:
> 
> > Does someone know how you could re-create this:
> >
> > (crontab -l of root)
> > # Regnerate stagit indexes every hour:
> > 0 * * * * (cd /var/www/git && echo `pwd` && /root/git_pragmatique_xyz.sh)
> >
> > in mcron?
> >
> > I have some cronjobs where the initial
> > current-working-dir must be a specific directory.
> >
> > I think I am missing (lambda) in what I have written below,
> 
> Indeed you are!  :-)
> 
> > but the mcron documentation just
> >
> > (define %stagit-job1
> >   #~(job '(next-hour '(4))
> >(and
> > (chdir "/srv/www/git/pragmatique")
> > (system* "sh" "/root/git_pragmatique.xyz.sh"
> 
> Something like:
> 
>   #~(job '(next-hour '(4))
>   (lambda ()
> (chdir …)
> (system* …)))
> 
> See 
> .
> 
> Ludo’.
> 

Thanks! This fixed at least the respawn-death of mcron. Now I just have to
see if it does what I want.
But it's good to know that it is that easy.
-- 
https://pragmatique.xyz
PGP: https://people.pragmatique.xyz/ng0/



Re: mcron job with cd to directory?

2017-05-17 Thread Ludovic Courtès
Howdy ng0,

ng0  skribis:

> Does someone know how you could re-create this:
>
> (crontab -l of root)
> # Regnerate stagit indexes every hour:
> 0 * * * * (cd /var/www/git && echo `pwd` && /root/git_pragmatique_xyz.sh)
>
> in mcron?
>
> I have some cronjobs where the initial
> current-working-dir must be a specific directory.
>
> I think I am missing (lambda) in what I have written below,

Indeed you are!  :-)

> but the mcron documentation just
>
> (define %stagit-job1
>   #~(job '(next-hour '(4))
>(and
> (chdir "/srv/www/git/pragmatique")
> (system* "sh" "/root/git_pragmatique.xyz.sh"

Something like:

  #~(job '(next-hour '(4))
  (lambda ()
(chdir …)
(system* …)))

See 
.

Ludo’.