shell脚本实例-批量检查多个网站地址是否正常
#!/usr/bin/bash
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
array=(
http://www.wosoquan.com
http://www.taobao.com
http://www.baidu.com
http://192.168.1.110
http://192.168.1.18
)
curl_ip(){
wget -T 5 -t 2 --spider $1 &>/dev/null #-T 设置超时时间 -t 设置链接的次数 --spider 进行参数检查
return $?
}
main(){
for n in ${array[*]}
do
curl_ip $n
if [ $? -eq 0 ];then
action "curl $n" /bin/true
else
action "curl $n" /bin/false
fi
done
}
main
作者简介:
陈志珂(头条号:强扭的瓜不好吃)目前就职于中国最大的安卓应用软件公司,任高级工程师,现在公司任php开发工程师,python开发工程师,高级运维工程师,公众号“铅笔学园”运维内容合作作者之一。
铅笔学园:IT资源分享|知识分享,做初级程序员的指明灯
shell脚本实例-批量检查多个网站地址是否正常的更多相关文章
- Shell学习---Shell脚本的静态检查工具shellcheck
Shell脚本的静态检查工具shellcheck ubuntu下 apt install shellcheck ,即可安装shellcheck.写完shell脚本,记得用它检查一下,能给你点建议的.要 ...
- (转)通过shell脚本实现批量添加用户和设置随机密码以及生产环境如何批量添加
通过shell脚本实现批量添加用户和设置随机密码以及生产环境如何批量添加 原文:http://www.21yunwei.com/archives/4773 有一个朋友问我如何批量创建用户和设置密码 , ...
- shell脚本:批量修改文件名
参考链接1:shell脚本:批量修改文件名(删除文件名中字符) 参考链接2:linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 ) 参考链接3:每天一个linux ...
- 分享7个shell脚本实例--shell脚本练习必备
概述 看多shell脚本实例自然就会有shell脚本的编写思路了,所以我一般比较推荐看脚本实例来练习shell脚本.下面分享几个shell脚本实例. 1.监测Nginx访问日志502情况,并做相应动作 ...
- shell脚本实例-系统监控
shell脚本监控网站并实现邮件.短信报警shell进程监控脚本(发送邮件报警)Shell脚本监控服务器在线状态和邮件报警的方法 http://www.jbxue.com/jb/shell/ 11. ...
- shell脚本实例,通向shell脚本大师的必经之路
概述 读书百遍其义自见,shell脚本也是,只要例子看得多了,自然就知道怎么写了.这里主要整理了20几个例子,因为内容比较多,所以分了几次来做介绍了.下面的实例最好先自己思考怎么去实现,然后再看下实现 ...
- shell脚本实例一
一. 什么是shell 脚本时一种解释性语言: shell脚本保存执行动作: 脚本判定命令的执行条件 脚本来实现动作的批量执行.二.如何创建 vim test.sh ##shell脚本一般都 ...
- shell脚本实例
备注:一些与传递给shell的参数相关的变量:$# 命令行参数的个数$? 调用命令的返回值$$ 当前进程的进程号$! 最后一个后台命令的进程号$0 命令行的第一个参数,也就是命令名$n 命令行的第n个 ...
- shell脚本实例一,移动文件夹中大于2000B的文件到另一个文件夹
shell脚本能帮我们简化linux下的一些工作,现在有个需求,把TMPA文件夹下大于2000B的文件都移动到TMPB下 #! /bin/bash function movefiles() { ` d ...
随机推荐
- 反射API(一)
<?php function classData(ReflectionClass $class) { echo '<hr>'; $details = '当前文件:'; $detail ...
- 关于StringUtils的常用方法
StringUtils.split(String, char) * <pre> * StringUtils.split(null, *) = null * StringUtils.spli ...
- 第二类Stirling数
第二类斯特林数 第二类Stirling数:S2(p, k) 1.组合意义:第二类Stirling数计数的是把p个互异元素划分为k个非空集合的方法数 2.递推公式: S2(0, 0) = 1 S2(p, ...
- leetcode-algorithms-17 Letter Combinations of a Phone Number
leetcode-algorithms-17 Letter Combinations of a Phone Number Given a string containing digits from 2 ...
- leetcode-algorithms-15 3Sum
leetcode-algorithms-15 3Sum Given an array nums of n integers, are there elements a, b, c in nums su ...
- 鼠标放上改变Button的大小
private void enterBtn_MouseLeave(object sender, MouseEventArgs e) { enterBtn.Wi ...
- SPA单页面应用
什么是单页应用 单页Web应用,就是只有一张Web页面的应用.浏览器一开始会加载必需的HTML.CSS和JavaScript,之后所有的操作都在这张页面完成,这一切都由JavaScript来控制.因此 ...
- 交互式shell编程
FQ #!/usr/bin/env shxfce4-terminal -x sudo python ./local/proxy.py 连续执行 gnome-terminal -x bash -c &q ...
- shell script auto generate the relevant header information
first : add follow context in /etc/vim/vimrc set ignorecaseset cursorlineset autoindentautocmd Buf ...
- learning at command AT+CSQ
AT command AT+CSQ [Purpose] Learning how to get mobile module single quality report [Eeviro ...
