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 http://www.debian-administration.org/articles/56:

 

*     *     *     *     *  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: http://forums.hostsearch.com/showthread.php?2693-Crontab-explained

Now...if you use the koha-common packages for Koha...you should never ever have to touch anything related to cron or think about cronjobs. They'll just happen automagically (http://en.wiktionary.org/wiki/automagical). 

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 (http://www.debian-administration.org/articles/56). 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 ;).

MARC21 Fixed Field Values

Today, I encountered a scenario where I was unsure of whether the 19th position of the Leader in a MARC21 record should be set to “a” for “Set” or whether it should be “#” for “Not specified or not applicable”.

I consulted a colleague from Germany who said the it should say “a” for “Set” only for a record that describes a set of physical items (rather than a journal that contains a set of articles).

I wasn’t sure that was necessarily the case based on the MARC21 information provided by the Library of Congress (http://www.loc.gov/marc/bibliographic/bdleader.html). However, I found this RDA => MARC mapping on the rdatoolkit.org website (http://access.rdatoolkit.org/document.php?id=jscmap1), which outright confirms my German colleagues statement.

If you do a search for “Multipart Resource record level” on that rdatoolkit page, you will see that a “Mode of Issuance” for a “Serial” should have a LDR 7 of “s” for serial and a LDR 19 of “#” for not specified or not applicable. You only set “a” (or “b” or “c”) if the mode of issuance is “Multipart Monograph”.

Obscure and esoteric? Undoubtedly. Without a doubt, your mileage will vary.

However, that’s apparently how the 19th position of the LEADER in MARC21 is supposed to work.  Take that for what it’s worth.