Background Tasks Not Running
Hello, All -
I'm just setting up a new cmsb site (v3.05) and I've noticed that the Background Tasks aren't running. I've set-up a cronjob but for some reason cron.php will not run. (NB: I can run it manually by putting the URL in the browser window.)
What seems odd is I CAN run another script in the same directory as cron.php via the cronjob.
It doesn't make sense. Is there a setting that I need to change?
Note, I have exactly the same type of cron set-up on a different site but with the same server host and that works fine. I've run a comparison between the 2 cron.php files and they are identical.
Can you check that the cronjob command in CMS Builder under Admin > Background Tasks is the same command you have setup to run with your host?
Here is an example cronjob command:
It will be different for each host and site. Also, check that if the version of PHP included in the command is correct.
Last thing to try is deleting the cronjob in your hosting account and creating a new one.
Let me know if this works. Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Hi, Damon -
Thanks for getting back to me. I've set-up cron jobs on numerous CMSB installations before - but this one just won't work! I've tried every conceivable permutation but cron.php simply will not run.
As I've said previously, I can drop a test script into the same directory as cron.php and that does run from the cronjob. The code looks like this:
* * * * * /usr/bin/php5 /homepages/path/htdocs/cmsb/cron.php
* * * * * /usr/bin/php5 /homepages/path/htdocs/cmsb/cronTest.php
The cronTest.php file runs fine - but there's not a peep from cron.php.
Out of interest, when I run cron manually the web interface suggests I should use this:
php -q /homepages/path/htdocs/cmsb/cron.php
Whereas the Background tasks suggests this:
I've tried these (and plenty of other permutations) and it just doesn't work.
I think I've cracked it! The 1&1 server requires a declaration of the specific php version required to run the script:
* * * * * /usr/bin/php5.5 /homepages/path/htdocs/cmsb/cron.php
Works fine now! Perhaps worth making a note of for future reference?
We try to guess the path the PHP on the server, but can't always tell. So it's always advisable to go with what your webhost recommends if the default doesn't work.
Just out of curiosity, if you "find in page" on php info here: admin.php?menu=admin&action=phpinfo Is there any references to "php5.5"?
And glad you got it working! Cheers