Le wiki de schplurtz

9. January 2012 crééeztrulphcs

busybox crond / crontab fields

I could not find easily what expressions are valid in crontab files for the busybox crond daemon. The man pages I found are minimalists – as busybox is itself – and only list the options that the crond commands accepts. No doc lists what you may write in the crontab file itself. I had to ”use the source, Luke !”.

Here is the relevant part of ''crond.c'' file for busybox 1.13.2

What does it tells us ? well, you can use things like this :

* * * * * touch /tmp/everyminute.$$
0-55/5 * * * * touch /tmp/every-5-minutes.$$
5,11,19,37,59 1,3,5,7,11,13,17,19,23 * * * touch /tmp/prime.$$
11,17,30-50/3 5,7,11-22/5,23 * jan-oct/3,12 sun-3/2 touch /tmp/guess-when.$$

MAILTO= may be obeyed or not, depending on the fact that your busybox crond was compiled with option for sending mail or not. How you can check that ? Don't know.


What if you enter something invalid ? In my case, there wass just a warning in the log. If you use this

 11,17,30-50/3 5,7,11-22/5,23 * jan-oct-nob/3,12 sun-3/2 touch /tmp/guess-when.$$

here is what you get in the logs

Jan  3 06:51:24 (none) cron.err crond[14635]: crond (busybox 1.13.2) started, log level 8
Jan  3 06:51:24 (none) cron.err crond[14635]: user root: parse error at jan-oct-nob/3,12