OK, I’ve been screwing around with a search engine CGI script for my web page, tinkering with it all day to get it just right. A normal person would’ve just put uploaded the darn thing at the default settings, only making the necessary file location changes to the scripts themselves. But not me. I’m a freak. I have to tinker with damn near every little option to see what it does. Of course, in the end, the script is pretty close to its default settings. Dumb, dumb, dumb.
However, that leads to this really dumb Linux question. Let me start by saying I knew nothing about using Linux two days ago, and in the interim I’ve only learned what I’ve needed to get from point A to point B (the web host company I’m using is running Linux). I’ve been winging it, but so far so good. Now I’ve got the nifty little search engine running. Trouble is, I need to schedule the indexer to run periodicially so the search index doesn’t get out of date. I’d like to use crontab to do it. So my question is about crontab syntax.
I understand the first five fields (minute, hour, day, etc). What I need to know is how to enter the path to the script. Do I do it all the way from root, or just from my entry point?
To illustrate:
From root, the script is at:
/home/username/www/cgi-bin/script/
But when I log in from telnet to run the indexer, I start in the username directory. So to get to the script, I only need to type:
cd www/cgi-bin/script/
So, when I set up the crontab, does it need to be:
0 0 * * * /home/username/www/cgi-bin/script/perl indexer.pl
or
0 0 * * * /www/cgi-bin/script/perl indexer.pl ?
Also, is it necessary to call perl from the crontab? e.g., is the command “perl indexer.pl” (as it is from the telnet prompt) or just plain “indexer.pl” (as it is when a web browser runs a script)?
So, can anyone help me out here? Bonus points for making me see the rhyme and reason behind all this.