cd /home/xwj/
nano .bashrc
function network()
{
#超时时间
local timeout=1
#目标网站
local target=www.baidu.com
#获取响应状态码
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
if [ "x$ret_code" = "x200" ]; then
return 1
else
return 0
fi
return 0
}
network
if [ $? -eq 0 ];then
echo "no internet connect..."
sleep 10
else
echo "internet is working...."
break
fi
cd /home/xwj/
python xwjplayer.py
浙公网安备 33010602011771号