]> Sergey Matveev's repositories - sgmon.git/blobdiff - helper/http
Missed togrep
[sgmon.git] / helper / http
index a917d218538e59f498eea59703fd3a66c4b96789..732ab2a413c54aa1777c176e3babab976bceccf5 100755 (executable)
@@ -1,9 +1,17 @@
 #!/bin/sh -e
 
-bad=0
-curl --max-time 60 --verbose "$1" >state/curl-out 2>&1 || bad=1
-grep -q "$togrep" state/curl-out || bad=1
-if [ "$bad" -eq 1 ] ; then
-    cat state/curl-out
-    exit 1
-fi
+domain=`echo "$1" | cut -d/ -f3 | cut -d: -f1`
+togrep="$2"
+"$SGMONDIR"/helper/all-addrs $domain | while read addr ; do
+    bad=0
+    curl \
+        --connect-to "::[$addr]:" \
+        --range 0-100 \
+        --max-time 60 \
+        --verbose "$1" >state/curl-out 2>&1 || bad=1
+    grep -q "$togrep" state/curl-out || bad=1
+    if [ "$bad" -eq 1 ] ; then
+        cat state/curl-out
+        exit 1
+    fi
+done