NAME="ilines_update" AUTHOR="Pim van Pelt" MAILTO="pim@ipng.nl" ESCALATE_MAILTO="pim@ipng.nl" MASTERLOG="/home/ircd/cronscripts/logs/${NAME}.log" PATH=/usr/local/bin:/usr/bin:/bin:/home/ircd/bin INPUT_DELEGATED="/home/ircd/ircd/ripedb/delegated-ripencc-latest" do_country() # $1=country $2=class $3=threshold { delegated_ilines.py -i $INPUT -o ilines.$1.$$ -c $1 -y $2 [ ! -r ilines.$1.$$ ] && return -1 [ `wc -l ilines.$1.$$ | awk '{ print $1 }'` -lt $3 ] && { warning "$1: File too short, less than $3 lines" rm -f -- ilines.$1.$$ return -2 } mv ilines.$1.$$ ../include/ilines.$1.conf return 0 } do_asn() # $1=asn(s) $2=class $3=threshold { asset_ilines.py -a '' -o ilines.asn.$$ -l $1 -y $2 [ ! -r ilines.asn.$$ ] && return -1 [ `wc -l ilines.asn.$$ | awk '{ print $1 }'` -lt $3 ] && { warning "$1: File too short, less than $3 lines" rm -f -- ilines.asn.$$ return -2 } mv ilines.asn.$$ ../include/ilines.asn.conf return 0 } do_asset() # $1=as-set(s) $2=class $3=threshold { asset_ilines.py -l '' -o ilines.as-set.$$ -a $1 -y $2 [ ! -r ilines.as-set.$$ ] && return -1 [ `wc -l ilines.as-set.$$ | awk '{ print $1 }'` -lt $3 ] && { warning "$1: File too short, less than $3 lines" rm -f -- ilines.as-set.$$ return -2 } mv ilines.as-set.$$ ../include/ilines.as-set.conf return 0 } function bitcron_main() { cd /home/ircd/ircd/etc || fatal "No config directory" echo "Gathering I-Lines for countries" do_country ch 200 1000 do_country li 202 15 echo "Gathering I-Lines for AS numbers" ASN_LIST=$(awk -F'|' '$2=/(CH|LI)/ { if ($3 == "asn") { n++; if (n>1) { printf "," }; printf $4 } }' < $INPUT_DELEGATED ) do_asn $ASN_LIST 250 1000 echo "Gathering I-Lines for AS-SETs" do_asset AS-IP-MAN-PEERING-TIX,AS-IP-MAN-PEERING-CIXP,AS-IP-MAN-PEERING-SWISSIX 300 1000 # svn commit -m "Automatic I-lines update by ilines_update.cron" }