
September 16th, 2006, 07:07 PM
|
|
Contributing User
|
|
Join Date: Aug 2005
Posts: 79
  
Time spent in forums: 15 h 45 m 51 sec
Reputation Power: 7
|
|
|
Problem with setting cron job script
My site's host has a unique method for running cron jobs, namely that they need to be "web based." The script that I'm running (rebuilding an index for my sites search) isn't a web based script. My host recommends wrapping the script and here's the example code they provide:
Code:
#! /bin/sh
echo "Content-type: text/plain";
echo;
cd "${SITE_ROOT}/var/www/html";
"${SITE_ROOT}/var/www/html/bin/example.pl";
echo "Script completed with exit code $?.";
exit 0;
The script has it's own arguments which look like this:
Code:
#!/bin/sh
cd /webroot/www.xav.com/search/searchmods/powerusr
perl cmd_admin.pl Password=password rebuild All
I've tried mixing them together with several different combinations however I keep getting any one of three outputs:
Code:
- "Script completed with exit code 2."
- "Script completed with exit code 127."
- "Warning: You have ENV SERVER_SOFTWARE defined. Unset it.
Content-Type: text/html
This script can only be called from the command-line.
Script completed with exit code 0."
At this point I'm at a loss as to what to try next; I keep getting those three outputs in addition the search index is *not* being rebuilt. Here is one of my attempts to get the code to work:
Code:
#! /bin/sh
echo "Content-type: text/plain";
echo;
cd "/var/www/cgi-bin/search/searchmods/powerusr";
perl "cmd_admin.pl Password=admin rebuild All";
echo "Script completed with exit code $?.";
exit 0;
I've tried numerous other combinations such as leaving out the quotes around the paths, inserting the ${SITE_ROOT}, listing the full absolute path for both the 'cd' and for the 'perl' command, and probably numerous others I don't recall off the top of my head. I'm wondering if there's anything that stands out as an obvious solution or if anyone can point me in a direction to figure it out.
Thanks a ton 
|