[systemd-devel] systemd-cron: retrigger generator after /var is mounted

Alexandre Detiste alexandre.detiste at gmail.com
Wed Oct 29 16:27:50 PDT 2014


Le mercredi 22 octobre 2014, 13:07:39 Lennart Poettering a écrit :
>So, I thought myself a couple of times about adding a cron generator
>upstream, but always came to the conclusion that having to load the
>configuration **twice** during boot-up would be suboptimal. 

> Well, you can order your reload service After=local-fs.target, which
> should do the trick. As /var might be subdivided into more submounts
> you really want to order after local-fs.target, and nothing earlier.

Ok, thanks, I have it mostly solved now.

I have my generator check for /var/spool... and writing a service in /run to call itself again **only** if needed.

On the second run of the generator, this service is not generated again, it just vanish; it acts like a transient unit.

So, on systems with /var in /, it run once; and on systems with a separate /var, it run twice.

It is set to run After=local-fs.target and Before=cron.target

The only remaining problem is that the added timer is not started.

Is "systemctl daemon-reload" really synchronous, or does it return before the reload if effectively done ?
(I saw the "--no-block" argument that make me fear this)


● cron-after-var.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead) since jeu 2014-10-30 00:00:39 CET; 13min ago
  Main PID: 370 (code=exited, status=0/SUCCESS)

● cron-tchet-tchet-0.timer - [Cron] "40 8 * * * /home/tchet/.ben/ben.sh"
   Loaded: loaded (/var/spool/cron/crontabs/tchet)
   Active: inactive (dead)
     Docs: man:systemd-crontab-generator(8)

https://github.com/systemd-cron/systemd-cron/blob/master/src/bin/systemd-crontab-generator#L405

Alexandre Detiste
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boot.svg
Type: image/svg+xml
Size: 61138 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141030/3fa38989/attachment-0001.svg>


More information about the systemd-devel mailing list