Cronjobs in Debian

When I first started developing and managing Koha, the most mysterious things in my mind were cronjobs and Zebra indexing.

Well, I’ve learned a lot about Zebra indexing over the past year. I think I’ve already shared quite a bit on this blog and I’m sure there is more to come. Maybe I’ll even re-visit some old entries to give better explanations sometime.

However, right now I’d like to talk about cronjobs. Cronjobs are basically commands that are scheduled to occur at specific times. They can look scary: 15 17 * * * COMMAND.

That would translate as: “Run this ‘COMMAND’ every day of every month at 5:15pm.

Here is a graphic I stole from


*     *     *     *     *  Command to be executed
-     -     -     -     -
|     |     |     |     |
|     |     |     |     +----- Day of week (0-7)
|     |     |     +------- Month (1 - 12)
|     |     +--------- Day of month (1 - 31)
|     +----------- Hour (0 - 23)
+------------- Min (0 - 59)

Another useful site I stumbled across was this:

Now...if you use the koha-common packages for should never ever have to touch anything related to cron or think about cronjobs. They'll just happen automagically ( 

This is just for folks who either don't use the koha-common packages, or for those who just want to know how cron works.

In Debian, you'll notice that there are other areas than the crontab that can be used for scheduling cronjobs. These are cron.d, cron.daily, cron.hourly, cron.weekly, cron.monthly ( In all cases except cron.d, any scripts that you put in these directories will be executed daily, hourly, weekly, or monthly (the exact times being determined in the crontab). cron.d is there for your more specific cronjobs. For instance, maybe you want COMMAND X to run every 5 minutes. You would set up a special script (like koha-common or anacron) and type in: "*/5 * * * * COMMAND X"

Easy as pie! Easier, in fact.

There’s certainly more to cron than what I’ve laid out (you can get more sophisticated), but that’s what those other links are for ;).