A miracle in cron?

Thursday, May 16, 2024

I am working on #5588.

On a Lino server with two sites a and b, we have two scripts make_snapshot_a.sh and make_snapshot_b.sh in /etc/cron.daily/, both generated by getlino startsite as follows:

#!/bin/sh
# generated by getlino
sudo service supervisor stop
/usr/local/lino/lino_local/a/make_snapshot.sh > /dev/null
sudo service supervisor start

But the daily snapshots were not being made. And no error message. We moved the two scripts to /usr/local/bin/ and created a new script /etc/cron.daily/linobackups with the following content:

#!/bin/sh
/usr/local/bin/make_snapshot_a.sh > /dev/null
sleep 5
/usr/local/bin/make_snapshot_b.sh > /dev/null

And after this change the daily snapshots started to work again! A miracle!?

That’s the kind of situations where Hannes stops worrying and where I start worrying. Because this would mean that getlino startsite does something wrong. And because I don’t believe in miracles. I am pretty sure that the additional linobackups script was not the explanation.

So I undid this move:

$ mkdir ~/20240516
$ cd ~/20240516
$ sudo mv /etc/cron.daily/linobackups .
$ sudo mv /usr/local/bin/make_snapshot_a.sh /etc/cron.daily/
$ sudo mv /usr/local/bin/make_snapshot_b.sh /etc/cron.daily/

P.S. 2024-05-31:

And yes, after my change the daily snapshots stopped again to work. And I explained to Hannes that I don’t want a solution, I want an explanation. And after two weeks of research, Hannes found this explanation (in a discussion on SO): run-parts (which is used by cron) ignores files with a period in the name.

So yes, getlino startsite did something wrong. I made the change, it was a single line of code.

Yes, the stupidest errors are the hardest to find!