tmp and fix
This commit is contained in:
parent
2b8111cb3e
commit
fa4da27930
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
etc/config.ini
|
etc/config.ini
|
||||||
|
tmp/
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<?php
|
<?php
|
||||||
$mypath="/opt/bgpblist";
|
$mypath="/opt/bgpblist";
|
||||||
$myurl="https://hosts.funil.de/custom/";
|
$myurl="https://hosts.funil.de/custom/";
|
||||||
|
$mytmp=$mypath."/tmp";
|
||||||
|
@mkdir($mytmp);
|
||||||
if ( !file_exists($mypath."/etc/config.ini") ) {
|
if ( !file_exists($mypath."/etc/config.ini") ) {
|
||||||
echo "ERROR: no config file\n";
|
echo "ERROR: no config file\n";
|
||||||
copy($mypath."/etc/default/config.ini",$mypath."/etc/config.ini");
|
copy($mypath."/etc/default/config.ini",$mypath."/etc/config.ini");
|
||||||
@ -19,7 +21,7 @@ pcntl_signal(SIGHUP,"sig_handler");
|
|||||||
$prev_bad=array();
|
$prev_bad=array();
|
||||||
$file_size=0;
|
$file_size=0;
|
||||||
$full_url=$myurl.$customer.'/csubscr_aggr.txt';
|
$full_url=$myurl.$customer.'/csubscr_aggr.txt';
|
||||||
clean_routes();
|
clear_routes();
|
||||||
while(TRUE) {
|
while(TRUE) {
|
||||||
$cycle_beg=microtime(TRUE);
|
$cycle_beg=microtime(TRUE);
|
||||||
logtofile("CYCLE_BEG");
|
logtofile("CYCLE_BEG");
|
||||||
@ -91,10 +93,10 @@ function logtofile($text) {
|
|||||||
file_put_contents($logfile,$data,FILE_APPEND);
|
file_put_contents($logfile,$data,FILE_APPEND);
|
||||||
}
|
}
|
||||||
function sig_handler($sig) {
|
function sig_handler($sig) {
|
||||||
clean_routes();
|
clear_routes();
|
||||||
exit_die();
|
exit_die();
|
||||||
}
|
}
|
||||||
function clean_routes() {
|
function clear_routes() {
|
||||||
logtofile("CLEANING_RT");
|
logtofile("CLEANING_RT");
|
||||||
passthru("ip route show | grep '^prohibit ' | awk '{print $2}' | xargs -I '{}' ip route del prohibit '{}'");
|
passthru("ip route show | grep '^prohibit ' | awk '{print $2}' | xargs -I '{}' ip route del prohibit '{}'");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user