Monday, February 19, 2007


This is a useful program for scheduling routine tasks initiated by scripts. Developing on the search installation from last week, we will write a crontab entry to update the namazu index daily.

First of all check which jobs are currently scheduled:

user@compy:~> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXX8NR6OC installed on Mon Feb 5 17:51:55 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
0 5 * * * /home/user/

This is the rsync job from the other week. So, next we need to create a script to run the namazu index. This is a simple shell script with the following command in it:
mknmz -O ~/.namazu/index/ ~/work/articles/

Save this file somewhere like in ~/.namazu/ Append this to the crontab in the same way as the rsync script was added - i.e. type crontab -e and add the following line:
0 5 * * * /home/user/.namazu/

Then, type crontab -l to check that it has been added. You should now have a namazu index that updates everyday at 5AM.

No comments: