Re: [dev] [ccrond] the C cron daemon

From: Tobias Bengfort <tobias.bengfort_AT_posteo.de>
Date: Wed, 18 May 2022 06:03:11 +0000

Hi Rodrigo,

your code certainly is much simpler, which is great. However, I think
you could push this even further.

 From a command that calls itself "cron" I would expect that it supports
crontabs. So maybe you should use a different name. But once you include
the configuration in the code you can optimize more agressively: There
is no need to wake up once per minute, you can calculate the sleep
duration at compile time.

Apart from that, your command does not cover some edge cases, e.g.
daylight saving time or downtime. Also, from personal experience, it is
frustrating to have to debug failed cron jobs. So some words in the
README about logging would be nice.

thanks,
tobias


On 17/05/2022 22.25, Rodrigo Martins wrote:
> One day I was reading the source of scron and all the parsing made me unhappy, so I set out to write my own cron daemon that hopefully sucks less. This is what I came up with.
>
> ccrond is a daemon that runs commands periodically. The crontab is defined in the C language, meaning there is no file parsing and allowing for minimal memory usage and very simple code.
>
> Here's an example crontab file:
>
> START_CRONTAB
> DO downloadNews EVERY 30 MINUTES
> DO syncMirror EVERY 10 HOURS
> DO cleanCache EVERY 6 MINUTES
> DO backupSysConfig EVERY 2 DAYS AND 20 MINUTES
> DO backupMail EVERY 5 DAYS AND 7 HOURS
> DO backupMedia EVERY 6 WEEKS
> END_CRONTAB
>
> Those verbs are actually C functions, but calling system() in them is a fine approach.
>
> I have written about it in
> gemini://expert.chickenkiller.com/project/ccrond/index.gmi
>
> And I have published the source code at
> git://expert.chickenkiller.com/ccrond.git
>
> I've also made the first patch to get us started. Feel free to tell me what you think, list it in https://suckless.org/rocks/ and send patches.
>
> Rodrigo.
Received on Wed May 18 2022 - 08:03:11 CEST

This archive was generated by hypermail 2.3.0 : Wed May 18 2022 - 08:12:08 CEST