检测cdn资料是否同步完成工具(单文件)

检测cdn文件是否同步完成工具(单文件)

#!/bin/sh

URL=$1
result=`curl -o /dev/null -s -m 10 --connect-timeout 10 -w %{http_code}  $URL`
test=`echo $result`
if [[  "$test" = "200"  ]];then
        echo 'cdn sync ok'
else
        while [ "$test" != "200" ];do
                result=`curl -o /dev/null -s -m 10 --connect-timeout 10 -w %{http_code}  $URL`
                test=`echo $result`
                if [[  "$test" != "200"  ]];then
                        sleep 2
                        continue
                else
                        echo 'cdn sync ok!'
                fi
        done
fi