improvements
This commit is contained in:
parent
cbc2ce2610
commit
2b8111cb3e
@ -1,12 +1,14 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
if ( !file_exists("/opt/bgpblist/etc/config.ini") ) {
|
||||
$mypath="/opt/bgpblist";
|
||||
$myurl="https://hosts.funil.de/custom/";
|
||||
if ( !file_exists($mypath."/etc/config.ini") ) {
|
||||
echo "ERROR: no config file\n";
|
||||
copy("/opt/bgpblist/etc/default/config.ini","/opt/bgpblist/etc/config.ini");
|
||||
copy($mypath."/etc/default/config.ini",$mypath."/etc/config.ini");
|
||||
echo "INFO: file created, edit it before next start\n";
|
||||
die();
|
||||
}
|
||||
$conf=parse_ini_file("/opt/bgpblist/etc/config.ini",TRUE);
|
||||
$conf=parse_ini_file($mypath."/etc/config.ini",TRUE);
|
||||
$customer=$conf["customer"]["cust_uuid"];
|
||||
$logfile=$conf["syslog"]["logfile"];
|
||||
declare(ticks = 1);
|
||||
@ -15,17 +17,27 @@ pcntl_signal(SIGINT,"sig_handler");
|
||||
pcntl_signal(SIGTERM,"sig_handler");
|
||||
pcntl_signal(SIGHUP,"sig_handler");
|
||||
$prev_bad=array();
|
||||
$file_size=0;
|
||||
$full_url=$myurl.$customer.'/csubscr_aggr.txt';
|
||||
clean_routes();
|
||||
while(TRUE) {
|
||||
$cycle_beg=microtime(TRUE);
|
||||
logtofile("CYCLE_BEG");
|
||||
$raw=@file_get_contents('https://hosts.funil.de/custom/'.$customer.'/csubscr_aggr.txt');
|
||||
$raw=@file_get_contents($full_url);
|
||||
$prev_size=$file_size;
|
||||
$file_size=strlen($raw);
|
||||
if ( strlen($raw) == 0 ) {
|
||||
logtofile("EMPTY_REM");
|
||||
$sleeptime=10;
|
||||
logtofile("SLEEP: ".$sleeptime."s");
|
||||
sleep($sleeptime);
|
||||
continue;
|
||||
} elseif ( $file_size == $prev_size ) {
|
||||
logtofile("NO_CHANGE ".$prev_size);
|
||||
$sleeptime=10;
|
||||
logtofile("SLEEP: ".$sleeptime."s");
|
||||
sleep($sleeptime);
|
||||
continue;
|
||||
}
|
||||
$tmp=explode("\n",$raw);
|
||||
$bad_nets=array();
|
||||
|
Loading…
Reference in New Issue
Block a user