简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM