shell 函数法实现监控web 网站url

使用shell 函数实现监控web 网站url

[root@linux-node3scripts]#catcheckweb.sh
#!/bin/bash
functionusage(){
echo$"usage:$0url"
exit1
}
functioncheck_url(){
wget--spider-q-o/dev/null--tries=1-T5$1
if[$?-eq0]
then
echo"$1isyes."
else
echo"$1isno."
fi
}
functionmain(){
if[$#-ne1]
then
usage
fi
check_url$1
}
main$*


脚本运行如下

[root@linux-node3scripts]#shcheckweb.sh
usage:checkweb.shurl
[root@linux-node3scripts]#shcheckweb.shwww.baidu.com
www.baidu.comisyes.
[root@linux-node3scripts]#shcheckweb.shwww.baidu89988.com
www.baidu89988.comisno.
[root@linux-node3scripts]#

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...