[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

crontabs + m4 = ?



How about modifying cron to read its files using a preprocessor, like m4?
That would be a more flexible solution than fixed "include *" or
"cat *>crontab" and it wouldn't be much harder to do.

I'm using cpp as an example. Imagine it's m4 :).

Reading all files:

#include "debian/functions"
#include "crontabs/*" /* cpp's not good enough */

More complex usage:

#define feb_has_28_days(year) ((year % 4) || !(year % 100) && (year % 400))
#define Y 1998

#if feb_has_28_days(Y)
0 4 28 2 * echo blah
#else
0 4 29 2 * echo yeah
#endif

You can go where no one has gone before:

#define easter(year) (...)
#define yom_kippur(year) (...)
#define ramadan(year) (...)

#define low_load(year) (easter() || yom_kippur() || ramadan())

1 2 low_load(Y) mirror_the_whole_internet


-Topi




--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: