Page 1 of 1
Cron's runtime of php script
Posted: Thu Jan 11, 2007 7:18 pm
by afbase
I want to run a cron job of a php script. The script loops/curls ~81,000 webpages so it takes about 5-8 hours to complete (i haven't had enough time to time it!).
I've read on other forums that cron has a limited php runtime of 15 minutes for Ubuntu dapper drake. I was curious as to lengthen the runtime of php scripts.
Code: Select all
25 1 * * * time php /home/clinton/hdd1/coldowl/project/stock/tests/stock_class.php
Posted: Thu Jan 11, 2007 7:34 pm
by feyd
Why not break up the number of pages into blocks of say 100 or ten? You can then run the script more often and have it check which blocks aren't in use taking the first one for itself.
how on earth do you break up the loop into blocks?
Posted: Thu Jan 11, 2007 8:18 pm
by afbase
I'm not familiar on how to break up loops into sets in mysql.
Code: Select all
$stockdata = new stockdata();
$sqldb=mysql_connect( $stockdata->localhost, $stockdata->mysql_user , $stockdata->mysql_pass );
if ( mysql_select_db( intelligent , $sqldb ) ) {
print "Select of intelligent complete<br>";
}
else {
die ("Select failed database name intelligent Error number: <b>".mysql_errno().
" Message: ".mysql_error()."</b>");
}
print "Rows = ".mysql_num_rows($returnval)."<BR>";
$returnval = $stockdata->do_query("SELECT * FROM curldata", $sqldb);
while ($a_record = mysql_fetch_row($returnval)) {
print "<pre>";echo $a_record[0];print "</PRE>";
$stockdata->set_ticker($a_record[0]);
$quiz=$stockdata->get_ticker();
$stockdata->getdata_storemysql();
}
any suggestions???
Posted: Thu Jan 11, 2007 8:49 pm
by Kieran Huggins
I think you use MySQL's "OFFSET" and "LIMIT" commands - it should be fairly straightforward. In fact, as long as you sort by last_update_time you can get away with just using "LIMIT".