0

The specific question for cron using Dillon's minimalist cron version is:

How to create a cron job that runs every first Friday of the month, in ASYNC mode?


Dillon's cron attempts to mix synchronous cron (the traditional) and asynchronous (anacron style) in a single daemon.

The idea is great, but the execution not so much, as one needs to read attentively what makes a cron entry SYNC or ASYNC. (It would be better just to have a TAG like SYNC and ASYNC in the line, and end this problem, but I diverge).

From what I understand, lines that causes the behavior to be ASYNC are those that uses the formats

  • @freq ID command or
  • * * * * * ID FREQ=X command.

Those will create a file at /var/spool/cron/cronstamps.

To create a SYNC entry that runs every first Friday of the month, it would be, for example:

10 5 1 * fri ID=scrubzpool /sbin/zpool scrub tank

And to make this ASYNC, once a month (but not every first Friday), the options would be:

@monthly ID=scrubzpool /sbin/zpool scrub tank

Maybe there is a way to explain month on FREQ= tag, but I'm not sure. The best I could come up with was 4 weeks:

10 5 1 * * ID=scrubzpool FREQ=4w /sbin/zpool scrub tank

The github code is here, but with special relation to this question is the file database.c , function ParseInterval, line 677.

I cannot find any explanation on how to mix FREQ= with traditional cron entry to achieve every first Friday of the month.

I wonder if this is correct:

10 5 1 * fri ID=scrubzpool FREQ=4w /sbin/zpool scrub tank

Or something that could create such result.

DrBeco
  • 109
  • 6
  • I added the last command line from the question above to a crontab, and the spool says it will run after `2023-05-04 16h17`, which is a Thursday. Not sure if the file just marks the inferior limit, and the cron syntax will be applied at a later point. – DrBeco Apr 06 '23 at 19:22

0 Answers0