Helpful Information
 
 
Category: Solutions
Cron job problem

Hi everyone, I am a new customer and I think I am going to like it here :) Now, I have setup my site and everything seems to run smoothly. However I came to a problem when I tried to run a cron job, it's a php script which I want to run every minute. I have setup my cron job like this "* * * * * /usr/local/bin/php /var/www/html/bal_ctf/script.php 2>&1 > /dev/null" but it doesn't seem to work. It works if I run it straight from the command line but the job doesn't run. Any help would be appreciated. Thanks.

Try:

* * * * * /usr/local/bin/php /var/www/html/bal_ctf/script.php

Also have a look at this related thread:
http://forums.westhost.com/showthread.php?t=8951

Thanks for the quick reply. That's the code I am using, I have also tried without the "2>&1 > /dev/null" and at the top of the cron I added MAILTO=myemailhere but no email came. It's like the cron job doesn't run :(

It's ok, I am so new to this that I thought that by just editing the file it was going to work. I actually had to install the cron job. Works fine now :)

It's ok, I am so new to this that I thought that by just editing the file it was going to work. I actually had to install the cron job. Works fine now :)

By that do you mean you restarted the VPS/Apache? How did you edit the file? Did you use "editcron -e"?

I was just editing the file through ftp, after I searched in google I found out what I had to do :)

I was just editing the file through ftp, after I searched in google I found out what I had to do :)

Hmmm . . . I'm surprised this worked. I would swear that editcron/crontab was doing something else other than just editing the cron file. Glad it worked for you.










privacy (GDPR)