diff --git a/openmptcprouter/files/bin/omr-test-speed b/openmptcprouter/files/bin/omr-test-speed index c38fcd9e4..fa95ff2cc 100755 --- a/openmptcprouter/files/bin/omr-test-speed +++ b/openmptcprouter/files/bin/omr-test-speed @@ -28,11 +28,15 @@ if [ -z "$INTERFACE" ]; then else domain=$(echo $HOST | awk -F/ '{print $3}') hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ') - for ip in $hostip; do - ipset add ss_rules_dst_bypass_all $ip - done + if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then + for ip in $hostip; do + ipset add ss_rules_dst_bypass_all $ip + done + fi curl -4 --interface $INTERFACE $HOST >/dev/null || echo - for ip in $hostip; do - ipset del ss_rules_dst_bypass_all $ip - done + if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then + for ip in $hostip; do + ipset del ss_rules_dst_bypass_all $ip + done + fi fi