I have a bash script which is executing php script. My bash knowledge is poor and I need to execute that PHP script about hundred times. I simply copy pasted the execute line:
#!/bin/bash
php /home/me/public_html/script/stats.php 1 2 3
php /home/me/public_html/script/stats.php 1 2 3
php /home/me/public_html/script/stats.php 1 2 3
...
1,2,3 are arguments i pass to php script.
All works fine, but after 8-th line bash script hangs not going into executing next. So I have to restart it again.
What can be wrong?
UPD
PHP (not full script but general idea)
It starts with retrieving command line args. Passes them to a function which uses them in a msql query. Every result of the msql query is passed to another function which uses that result to form up an url from which it retrieves a comma delimited string and processes it splitting it into array and inserting into another table. After main function completes the msql link is closed, script exits.
<?php
if (($argv[1] > 0) && ($argv[2] > 0) && ($argv[3] > 0)) {
echo "All good! Here we go: ";
echo "\n";
gatherstats($argv[1],$argv[2],$argv[3]);
} else {
echo "no\n";
}
function gatherstats($y,$m,$cl){
Require 'db.php';
// SQL QUERY HERE AND A LOOP TO PROCESS RESULTS
//CALLS UP NEXT FUNCTION FOR EACH RESULT
crawl($a,$b,$c);
}
function crawl($atr,$year,$month) {
//forms up specific url from passed vars and processes it
}
mysqli_close($link);
?>
100, and just do one callps -efhow.many instances of PHP are alive at the endps -efgive no alive php instances after the stop.