
GNU Mcron - howling
https://www.gnu.org/software/mcron/
======
jrq
I love that GNU loves Guile. There are few Scheme implementations as well
polished as guile is, and what a breath of fresh air it can be to sit down to
some '() stew after a few rough weeks of spreadsheet hell at work.

Might be just me, but it's kind of like having another universe to take a
vacation in.

It does make me miss types, doing data structure programming in scheme can be
irritating I guess, but still. I can compose, I can syntax-rules if I wanted,
etc.

The sexpr universe isn't dead yet.

~~~
eadmund
It's a pity GNU doesn't use Common Lisp instead of Scheme — it has rich types,
data structures & more. It's a language built for programming large systems,
rather than teaching small examples.

~~~
jrq
R7RS large is underway now! CL also has unhygienic macros, non-lispy loop
grossness, lots of cruft, lots of poorly named functions that are named two
different ways in two different places, and generally reeks of the 70s.

Scheme actually tried to compete with CL once, with a language called T. It
had something sorta similar to CLOS and if I recall it was aiming for
optimized performance per Sussman and Steele, but it eventually languished.

SBCL is the only thing keeping CL alive and they don't have the wherewithall
to begin a modernized spec.

I don't hate CL, but I LOVE scheme. It is much more pleasant to actually work
in, and feels cleaner. All the potholes of CL leave me checking under my
fingernails for grime.

~~~
lispm
> generally reeks of the 70s

Scheme was implemented as a clean toy/educational Lisp on top of Maclisp in
the mid 70s.

Scheme was defined too small upto R5RS and in R6RS is got unlispy.

> Scheme actually tried to compete with CL once

It never really did, since all implementations were different. There are lots
of great Scheme implementations (MIT Scheme, Chez Scheme, ...) - but all were
different. Then a bunch of extension were bolted onto Scheme - but the base
was too small.

> It is much more pleasant to actually work in, and feels cleaner.

Which Scheme? Chicken Scheme? Racket - which is no longer a Scheme? Kawa? They
are cleaner than CL?

The last clean Scheme was R5RS - and that was underspecified as a programming
language.

Whenever I used Scheme I missed keyword arguments, CLOS, LOOP, optimization
declarations, type declarations... Oh, wait. All those and much more has been
added to Scheme in some ways. Unfortunately the result does not look
'cleaner'.

Chicken Scheme:

    
    
        (define-method (pop (stack <stack>))
          (let* ((c (slot-value stack 'content))
                 (x (car c)))
            (set! (slot-value stack 'content) (cdr c))
            x))
    

Let's see how it's written in Common Lisp:

    
    
        (defmethod stack-pop ((s stack)) 
          (pop (slot-value s 'content)))

------
mrb
Guile syntax to run every second Sunday of the month (example taken directly
from the manual
[https://www.gnu.org/software/mcron/manual/mcron.html#Every-s...](https://www.gnu.org/software/mcron/manual/mcron.html#Every-
second-Sunday)):

    
    
      (job (lambda (current-time)
           (let* ((next-month (next-month-from current-time))
                  (first-day (tm:wday (localtime next-month)))
                  (second-sunday (if (eqv? first-day 0)
                                     8
                                     (- 14 first-day))))
             (+ next-month (* 24 60 60 second-sunday))))
         "my-program")
    

Meanwhile in cron (second Sunday falls between the 8th and 14th day of the
month, and it is the 7th day of the week):

    
    
      0 0 8-14 * * [ `date +\%u` = 7 ] && my-program
    

I think I'll stick with cron.

~~~
JD557
Couldn't that cronjob simply be: 0 0 8-14 * 0? (I think 0 is Sunday)

~~~
mrb
No because the dom field (8-14) and dow field (0) are treated as a logical OR
by cron, not AND.

------
sidhu1f
Some of Mcron's innovations[1]:

> The new idea is to read the required command instructions, work out which
> command needs to be executed next, and then sleep until the inferred time
> has arrived. On waking the commands are run, and the time of the next
> command is computed.

> Each user looks after his own files in his own directory. He can use more
> than one to break up complicated cron specifications. Each user can run his
> own daemon. This removes the need for suid programs to manipulate the
> crontabs, and eliminates many security concerns that surround all existing
> cron programs.

> Vixie cron is implemented in 4500 lines of C code; mcron is 1500 lines of
> scheme, despite the fact that it offers many more features and much more
> flexibility, and complete compatibility with Vixie cron.

[1]
[https://www.gnu.org/software/mcron/design.html](https://www.gnu.org/software/mcron/design.html)

~~~
JdeBP
One would have to check the timeline to determine whether the second was, in
fact, an Mcron innovation. Uwe Ohse's uschedule, which has been around since
2001, _also_ works by individual users having files in their own directories
with their own daemons.

* [https://ohse.de./uwe/uschedule.html](https://ohse.de./uwe/uschedule.html)

* [http://jdebp.eu./Softwares/uschedule/](http://jdebp.eu./Softwares/uschedule/)

------
otterley
Now that timers are baked into systemd[1], the days of cron and its cousins
seem to be numbered. The systemd timer specification is pretty rich, and since
it can control any arbitrary systemd unit, I can't imagine using a legacy
solution anymore.

[1]
[https://www.freedesktop.org/software/systemd/man/systemd.tim...](https://www.freedesktop.org/software/systemd/man/systemd.timer.html)

~~~
josteink
On embedded you really don’t find systemd anywhere. At least not yet.

Cron, busybox and friends are still good things to master.

~~~
jcelerier
> On embedded you really don’t find systemd anywhere.

don't you ? my phone from _2013_ runs systemd and wayland.

~~~
jchw
Out of curiosity, what phone/OS is that? I don't believe stock Android runs
either of those, right? (iirc, they have a custom init daemon and compositor,
am I wrong?)

~~~
Mediterraneo10
The OP is probably describing the Jolla 1 phone, released in 2013, and running
Sailfish OS that was based on Systemd and Wayland from launch.

~~~
jcelerier
Indeed

~~~
josteink
While _your_ phone may run systemd, modern phones are pretty powerful compared
to platforms traditionally considered "embedded".

It's also an extremely niché phone... Witch I seriously wanted to try out, but
couldn't because it was actually impossible for me to buy.

It's definitively not representative for phones in general, and certainly not
for embedded Linux as a wider term.

Edit: Things might be changing though.

For instance my Netgear NAS used to run a custom Debian-derivative based on
Debian 7 (which used sysvinit). But I discoverd today that after some recent
updates it's now based on Debian 8 (which ships with systemd instead).

Based on that, I could produce the following plot[1], on a "embedded" device.
Which I now know spends a tremendous 42 seconds booting the kernel. I guess it
contemplates life, the universe and everything before moving along :)

[1]
[https://gist.github.com/josteink/3cf87479b97d8ab3eac81cba719...](https://gist.github.com/josteink/3cf87479b97d8ab3eac81cba7199bbca#file-
nasboot-svg)

------
userbinator
_and allows configuration files to be written in scheme (as well as Vixie 's
original format) for infinite flexibility in specifying when jobs should be
run._

It looks like Greenspun's Tenth Rule has been taken to the next level.
Software that's so configurable its configuration files itself are written in
a Turing-complete language is the bane of enterprise development. IMHO if you
need such complex requirements, that should be done by something other than
the configuration file of what should be a simple task scheduler.

~~~
fulafel
I guess calling Guile an "ad-hoc, informally-specified, bug-ridden, slow
implementation of half of Common Lisp" could be a clever salvo in a religious
war between Scheme and Common Lisp programmers, but of course Mcron's approach
is heeding Greenspun's implied advice.

------
niftich
Not sure what the OP intended as the context around this submission, but
here's some more info:

Latest version 1.1.1 released 2018-04-08 [1][2]. Previous version was 1.1 on
2018-03-19, and the one before that dates to 2010-06-13 [2].

This is a job scheduler compatible with vixie-cron [3], but written in Guile
Scheme. Entries in a crontab file can be the traditional format, or snippets
of Guile. There's a whitepaper from 2003 [4] and up-to-date documentation [5]
that explain the rationale and usage.

[1] [http://lists.gnu.org/archive/html/info-
gnu/2018-04/msg00004....](http://lists.gnu.org/archive/html/info-
gnu/2018-04/msg00004.html) [2]
[http://savannah.gnu.org/projects/mcron/](http://savannah.gnu.org/projects/mcron/)
[3] [https://directory.fsf.org/wiki/Vixie-
cron](https://directory.fsf.org/wiki/Vixie-cron) [4]
[https://www.gnu.org/software/mcron/design.html](https://www.gnu.org/software/mcron/design.html)
[5]
[https://www.gnu.org/software/mcron/manual/mcron.html](https://www.gnu.org/software/mcron/manual/mcron.html)

------
jdormit
From the project documentation [0]:

> The mcron program represents a complete re-think of the cron concept
> originally found in the Berkeley and AT&T unices

"Unices" as in the plural of "Unix"? I've never heard that before, but that's
amazing.

[0]
[https://www.gnu.org/software/mcron/manual/mcron.html](https://www.gnu.org/software/mcron/manual/mcron.html)

~~~
Semirhage
The Latinate -ix suffix becomes -ice/s when pluralized, as in matrix and
matrices, or dominatrix and dominatrices.

~~~
lillesvin
However, -es (as in "unixes") should be perfectly acceptable too. Just like
how "indixes" and "matrixes" are fine in English.

~~~
timerol
I've seen "indexes" and "indices", but never "indixes". I assume that's a
typo. Or is "indix" a noun I don't know?

~~~
lillesvin
Yeah, that's a typo. Sorry about that.

------
amelius
I make backups using cron, and recently I've been wondering what happens if
the backup (hypothetically) takes longer than the interval between cron jobs.
Will it start the new job while the old one is still running? Will unrelated
cron jobs be blocked? And how is that in Mcron?

~~~
gmjosack
Yes. If you're worried about this you can take a look at `flock`. e.g.

    
    
        flock -xn /path/to/lock -c /path/to/command

------
blunte
For people who've never heard of this, the project home page is really missing
a simple opportunity to actually say "what is this Mcron thing?"

It wouldn't have been too difficult to take the small introduction from here:
[https://www.gnu.org/software/mcron/manual/html_node/Introduc...](https://www.gnu.org/software/mcron/manual/html_node/Introduction.html#Introduction)

------
equalunique
Mcron is included by default in GNU's Guile-centric GuixSD OS.

------
andrewshadura
Reminds me of a Windows-only nnCron, written in Forth.

------
thanatropism
Lost opportunity: EmaGNUel Mcron.

~~~
eat_veggies
That's a pretty good pun, but I'm not sure it's wise to attach this project to
a politician's name.

------
dethswatch
It wouldn't hurt to tell us what this actually is in the title.

"Gnu Mcon- a 100% compatible replacement for Vixie cron"

Would be a -way- better title.

HN seems to love to announce random products and updates without telling
anyone who doesn't already know what it is.

"Gnu Squanchydoo v3 released!"

TF is "Squanchydoo"? No idea, not going to bother to find out...

~~~
jimnotgym
It wouldn't hurt for the website linked to tell us what the package does at
least somewhere on the page, I will agree with that much. The first paragraph
tells me what it replaces, what language it is coded in and who wrote it...but
not what it does.

~~~
suprfnk
Would you not consider cron to be 'general knowledge' in the Hacker News
community?

~~~
s3m4j
I would, but I also would like to know in what way is it different from vixie
cron and what impact does it have on the user ?

~~~
rbanffy
It says exactly that. It's written in Guile (which is inconsequential until it
reaches the second part) and can take Scheme code as configuration file (which
is _very_ interesting).

~~~
s3m4j
I read that, but to the end user, that's not really a plus if the "old" syntax
works the same.

How does mcron's working differ from cron's ? That's what should be on the
front page, not the language its written in.

------
John_KZ
So it's like regular Mcron except without anti-union policies?

