better fetch
This commit is contained in:
parent
fa4da27930
commit
b173ba0a43
@ -21,11 +21,13 @@ pcntl_signal(SIGHUP,"sig_handler");
|
||||
$prev_bad=array();
|
||||
$file_size=0;
|
||||
$full_url=$myurl.$customer.'/csubscr_aggr.txt';
|
||||
$file_loc=$mytmp."/csubscr_aggr.txt";
|
||||
clear_routes();
|
||||
while(TRUE) {
|
||||
$cycle_beg=microtime(TRUE);
|
||||
logtofile("CYCLE_BEG");
|
||||
$raw=@file_get_contents($full_url);
|
||||
mirror_data();
|
||||
$raw=@file_get_contents($file_loc);
|
||||
$prev_size=$file_size;
|
||||
$file_size=strlen($raw);
|
||||
if ( strlen($raw) == 0 ) {
|
||||
@ -87,6 +89,11 @@ while(TRUE) {
|
||||
logtofile("SLEEP: ".$sleeptime."s");
|
||||
sleep($sleeptime);
|
||||
}
|
||||
function mirror_data() {
|
||||
global $full_url;
|
||||
global $mytmp;
|
||||
passthru("cd ".escapeshellcmd($mytmp)."; wget --mirror --no-directories --no-host-directories -q ".escapeshellcmd($full_url));
|
||||
}
|
||||
function logtofile($text) {
|
||||
global $logfile;
|
||||
$data=gmdate("Y-m-d H:i:s")." | ".$text."\n";
|
||||
|
Loading…
Reference in New Issue
Block a user