perl cron?

essares1

Junior Member
Joined
Apr 27, 2009
Messages
161
Reaction score
28
Does anyone know how to setup perl cron in Hostgator. I have tried this

Code:
/usr/local/bin/perl /home/USER/public_html/PATH/cgi-bin/script.pl

but its not working. I changed several things but nothing seems to work. Anyone?
 
Last edited:
Dunno about hostgator, but here are some generic things to look at:

1) Running as a user or as root?
2) cron.allow / cron.deny provisioned correctly?
3) What does your entire crontab entry look like?
4) What output are you getting from cron when the job runs? Check the owner's email...
5) Can you get a basic job to run? E.g., can you setup a 'echo "hello,world"' to run once a minute? No point in trying to do anything more complicated, if this base case is causing problems.
6) Obvious, I know, but is your path to perl correct?
7) Your command line looks correct but, what happens if you add
Code:
#!/usr/local/bin/perl
to the first line of script.pl and
Code:
'chmod +x ./script.pl'
?

My guess would be that you are having problems at #5 above. Once you get that fixed, you ought to be able to do what you want pretty easily.

--Ma
 
Yea I am trying to run a simple test script. The paths are all correct cause I could run the same thing from putty ssh. perl path is also correct. I can run the perl script and get output on my web browser too. the cronjob is not running at all. so no output to email.

What is cron.allow and deny? should I change it or something?
 
Edit your cron job and try something like:

Code:
cd /home/USER/public_html/PATH/cgi-bin/ && ./script.pl

You will have to +x the script as MaDeuce said.
 
you need to put the time for a cron, in this example every 5 minutes execute the test.pl script (chmod +x test.pl)
Code:
*/5 * * * *  /home/user/test.pl
 
If you are able to... check out your cron logs as well to see if there is a failure. You may have a failure reason in the logs.
 
Back
Top