Commit c1af50ad authored by Vitaly Lipatov's avatar Vitaly Lipatov

update_z-i.sh: replace ipset in a while with ipset restore from stdin

parent ed3e62d5
......@@ -11,23 +11,27 @@ if [ "$1" = "--show" ] ; then
exit
fi
#ip rule show | grep "lookup openroute" | sed -e "s|.*:||g" | sed -e "s|lookup|table|g" | while read str ; do
#done
ipset -exist create $SETNAME hash:ip maxelem $MAXELEM
# something like clean
ipset destroy $SETNAME.tmp
ipset create $SETNAME.tmp hash:ip maxelem $MAXELEM || exit
ipset -exist destroy $SETNAME.tmp
#ip rule show | grep "lookup openroute" | sed -e "s|.*:||g" | sed -e "s|lookup|table|g" | while read str ; do
# Obsoleted element by element
#ipset create $SETNAME.tmp hash:ip maxelem $MAXELEM || exit
## fill new ipset
#./get_ips_z-i.sh | sort -u | while read ip ; do
# ipset add $SETNAME.tmp $ip
#done
#ssh -q 192.168.1.217 -l xoxo| grep -v "Last login"| sed $'s/\r//' | while read ip ; do
./get_ips_z-i.sh | sort -u | while read ip ; do
#cat z | while read ip ; do
#ip rule add to $ip table openroute
ipset add $SETNAME.tmp $ip
done
ipset list $SETNAME.tmp | wc -l >$0.count
# Use single ipset run (see https://bugs.etersoft.ru/show_bug.cgi?id=12353)
( echo "create $SETNAME.tmp hash:ip hashsize 65536 maxelem $MAXELEM" ; \
./get_ips_z-i.sh | sed -e "s|^|add $SETNAME.tmp |" ) | ipset -exist restore
ipset list $SETNAME.tmp | wc -l >$0.count
ipset swap $SETNAME.tmp $SETNAME
# initial
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment