tmp and fix

This commit is contained in:
Grzegorz Surmann 2024-07-20 02:52:19 +02:00
parent 2b8111cb3e
commit fa4da27930
2 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
etc/config.ini
tmp/

View File

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