Sailesh Jaiswal
Sailesh Jaiswal

Reputation: 319

cron to run php script simultaneously

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.

Upvotes: 0

Views: 393

Answers (1)

l.renkema
l.renkema

Reputation: 2622

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.

Upvotes: 1

Related Questions