浏览代码

Fix trap registration

Edvinas Valatka 9 年之前
父节点
当前提交
013b5a5693
共有 2 个文件被更改,包括 3 次插入5 次删除
  1. 2 3
      e-badips
  2. 1 2
      e-pullasn

+ 2 - 3
e-badips

@@ -4,11 +4,10 @@ set -euo pipefail
 CONFD=/etc/e-router
 source $CONFD/config
 
-
 tmp=$(mktemp)
+trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM
+
 curl -f -s -m 60 -o $tmp "https://www.badips.com/get/list/${banservice}/${banlevel}?age=${rangecheck}"
 while read -r ip ; do
     ipset -! add ${banset} ${ip} timeout $bantime
 done < $tmp
-
-trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM

+ 1 - 2
e-pullasn

@@ -5,6 +5,7 @@ CONFD=/etc/e-router
 source $CONFD/config
 
 tmp=$(mktemp)
+trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM
 
 while read -r asn ; do
     [[ "$asn" =~ ^AS[0-9]{1,}$ ]] || continue
@@ -14,5 +15,3 @@ done < $CONFD/WHITE.asn
 grep -Eo "([0-9.]+){4}/[0-9]+" $tmp | while read -r net ; do
     ipset -! add  $whiteset $net timeout $routettl
 done
-
-trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM