autodist-cgi: check if host is up before fetching cgi data from secondary sites

This commit is contained in:
Silvan Calarco 2014-08-23 13:30:45 +02:00
parent f6543e78fa
commit bf3085f435

View File

@ -358,10 +358,14 @@ done
# only root host (0) calls other hosts
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do
if [ "$NUM" -a "$HOST" = "$h" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&REP=$RNUM&HOST=$HOST" 2>/dev/null
elif [ ! "$NUM" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
WBHOSTURL=`echo ${AUTOPORT_CGI_HOST[$h]} | sed "s|^\(http[s]*://[^/]*\).*$|\1|"`
if [ "$WBHOSTURL" ]; then
curl -m1 -s -I ${WBHOSTURL} >/dev/null || continue
if [ "$NUM" -a "$HOST" = "$h" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&REP=$RNUM&HOST=$HOST" 2>/dev/null
elif [ ! "$NUM" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
fi
fi
done
fi