0

I've set 3 crons to execute php files at every day at midnight. Every script does its own job like say a.php, b.php and c.php

a.php -> picks the term(text) from database and search it in google, facebook, twitter, google+ and store the results in database.

b.php -> picks the image from our website and search it in tineye.com database and store the results

c.php -> picks the business name and search its reviews on citygrid.com, google places, yelp.com and store them in database.

After every fetch it updates the next execution date, so that it could fetch the data for that term/image/business on that date.

My problem is

One, I've seen only few records from database are fetched and updated to db and later records are not updated. This could be because while fetching the data for starting terms, execution time get expired and it doesn't continue. I tried increasing the max_execution_time to 100000 but no luck.

Two, I see a.php, b.php and c.php doesn't start at same time.

syntax I used:

0 0 * * * /usr/bin/php /var/www/html/a.php 0 0 * * * /usr/bin/php /var/www/html/b.php 0 0 * * * /usr/bin/php /var/www/html/c.php 

I need the advice from the genius to make it work best.

4
  • If the problems are in your php code, then it isn't much help for us to see the cron entries... are you suggesting that cron is buggy? Commented Sep 7, 2013 at 18:15
  • All the php scripts are working fine when executed individually. Crons are not running at a time. When the first cron is executed/completed then the second one is running and when second is completed third starts running. So I want to know the way to execute all crons independently without waiting for the other. Another thing wanted to know is does max_execution_time has any effect on it. As every script takes lot of time, as it has to fetch data from database and search on google, facebook, twitter and google+ and then do the processing and store the results in database. Commented Sep 9, 2013 at 8:12
  • In that case, I suggest you contact the development team for your appropriate flavour of Linux and tell them that there is a fundamental bug in cron... cron should not allow only one task to be run at a time, but should trigger all tasks concurrently where required Commented Sep 9, 2013 at 8:14
  • Dear Mark, Thank you for the suggestion. Our website is hosted on godaddy.com. And godaddy will not allow you to access crontab from shell, has they provide a web interface to set the cron. Few years ago I've seen my seniors using something extra at the end of every line but not sure why or what did they do. Now I'm in another company... Commented Sep 9, 2013 at 8:22

1 Answer 1

1

When you run PHP from the command line (/usr/bin/php) there is no max_execution time. The max_execution is only used when using PHP from a webserver.

Try debugging the output when running the scripts by hand, setting error_reporting to E_ALL and output a lot of debug information. I think there is something wrong with your script that allows it to die without a message or something like that.

Sign up to request clarification or add additional context in comments.

1 Comment

All the php scripts are working fine when executed individually. Crons are not running at a time. When the first cron is executed/completed then the second one is running and when second is completed third starts running. So I want to know the way to execute all crons independently without waiting for the other. Another thing wanted to know is does max_execution_time has any effect on it. As every script takes lot of time, as it has to fetch data from database and search on google, facebook, twitter and google+ and then do the processing and store the results in database.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.