only create set if it does not exist
This commit is contained in:
parent
e974b64c5a
commit
9a4ceabb01
@ -66,8 +66,11 @@ for url in $urls; do
|
|||||||
new_list_size=$(wc -l "${sorted_blocklist}" | awk '{print $1;}' )
|
new_list_size=$(wc -l "${sorted_blocklist}" | awk '{print $1;}' )
|
||||||
hash_size=$(expr $new_list_size / 2)
|
hash_size=$(expr $new_list_size / 2)
|
||||||
|
|
||||||
|
if ! ipset -q list ${set_name} >/dev/null ; then
|
||||||
|
ipset create ${set_name} hash:net family inet
|
||||||
|
fi
|
||||||
|
|
||||||
# start writing new set file
|
# start writing new set file
|
||||||
echo "create ${set_name} hash:net family inet" >>"${new_set_file}"
|
|
||||||
echo "create ${tmp_set_name} hash:net family inet hashsize ${hash_size} maxelem ${new_list_size}" >>"${new_set_file}"
|
echo "create ${tmp_set_name} hash:net family inet hashsize ${hash_size} maxelem ${new_list_size}" >>"${new_set_file}"
|
||||||
|
|
||||||
# convert list of IPs to ipset statements
|
# convert list of IPs to ipset statements
|
||||||
|
Loading…
Reference in New Issue
Block a user