Posted by: Anonymous
[ip: 66.191.115.187]
on November 19, 2007 05:50 PM
I think you could change your grep/sed pipe to a single grep command (which I imagine would be slightly more efficient):
grep '^[^#]' /your/path/ip_msn
This should output any lines that start with something other than #, which also skips blank lines (because they start with nothing). I also think your loop could be rewritten like this to avoid the temporary file:
for IP in $(grep '^[^#]' /your/path/ip_msn) ; do
/sbin/iptables -t mangle -A PREROUTING -s $IP -p tcp --dport 1863 -j REJECT
done
Improved grep/script
Posted by: Anonymous [ip: 66.191.115.187] on November 19, 2007 05:50 PMThis should output any lines that start with something other than #, which also skips blank lines (because they start with nothing). I also think your loop could be rewritten like this to avoid the temporary file:
Regards,
Keith
#