linux 自动ping脚本,ping自动报警shell脚本forlinux
linux 的和solaris的居然不一样!
#!/bin/sh
PingConf='/opt/monitor/newIp'
#File where the log will be stored
LogDir='/opt/monitor/newLog'
#Define the interval time
INTERVAL='10'
#Define the alarm process
########################################################
proc_main()
{
while read IpAddress
do
#ingore any hash signs
case $IpAddress in
#*);;
*)
ping -w 20 $IpAddress -c 5 >errtmp$$
# ping $IpAddress -c 10 >errtmp$$
if [ $? = 0 ] ; then
rm errtmp$$
else
rm errtmp$$
ErrTime=`date +%Y/%m/%d/%H:%M:%S`
# echo "$ErrTime"": ""$IpAddress"" cann't be connected">>$LogDir
echo "$ErrTime"":""$IpAddress"" cann't be connected
">>$LogDir
sleep 1
cp /opt/monitor/newLog /opt/OV/www/htdocs/PingLog/new.html
sleep 1
# mail -s "$IpAddress"Cantreach -c 我的email
play -v 50 /opt/monitor/123.au
fi
esac
done
}
##########################################################
# execute the proc_main function every the specified time INTERVAL
while [ "1" -eq "1" ]
do
# execute the proc_main function
proc_main
# suspend execution for INTERVAL seconds
sleep $INTERVAL
done
linux 自动ping脚本,ping自动报警shell脚本forlinux相关推荐
- linux自动安装trojan客户端的shell脚本
#!/bin/bash # 安装Trojan客户端 echo "开始安装Trojan客户端..." curl -O https://github.com/trojan-gfw/tr ...
- linux脚本编写规则,shell脚本编写守则
现在centos7中使用的是bash软件,通过以下命令可以查看bash版本: [root@localhost ~]# cat /etc/redhat-release #查看系统的版本 CentOS L ...
- shell编写mysql全备和增备脚本_基于mysqldump编写自动全备增备的shell脚本
基于mysqldump编写自动全备增备的shell脚本 在线上MySQL数据库备份分为全备和增备,而xtrabackup备份已经支持了增量备份了,但是mysqldump就不支持增量备份,所以我们需要写 ...
- linux 脚本 获取pid,Shell脚本中获取进程ID的方法
提问: 我想要知道运行中脚本子shell的进程id.我该如何在shell脚本中得到PID. 当我在执行shell脚本时,它会启动一个叫子shell的进程.作为主shell的子进程,子shell将she ...
- 【跟晓月学shell脚本】掌握shell脚本变量原理及概念
前言 跟晓月一起学shell,死磕shell脚本,让shell脚本学习不再难. 想学习更多shell脚本的案例,可以前往我的师父的shell脚本专栏:shell脚本从入门到实战-案例篇 文章目录 前言 ...
- 什么是脚本语言,shell脚本又是什么?
脚本语言就是解释型语言: 脚本语言(Script language,scripting language,scripting programming language)是为了缩短传统的编写-编译-链接 ...
- Tcl/Tk脚本中执行Shell脚本
在Tcl/Tk脚本中执行Shell命令 set n 0 set x "*"while {$n < 10} {puts $xset x "$x"*set n ...
- 【跟晓月学shell脚本】掌握shell脚本变量实战案例
前言 上篇文章我们探讨了shell脚本变量的基本原理和概念,本篇我们基于上面的内容增加一些实战. 如果你还没有学习shell脚本的变量理论,可以点击链接:[跟晓月学shell脚本]掌握shell脚本变 ...
- 【CyberSecurityLearning 34】Linux脚本编写(Shell脚本)
目录 脚本 一个简单的脚本 实现流程: 变量赋值 IF判断语句 if单分支结构 if 双分支结构 if 多分支结构 实用案例:检测内网主机存活状态 Shell循环语句(for.while) for循环 ...
- linux下测试网卡是否连通shell脚本
欢迎移步博主小站:白亮吖雅黑丫の小站 linux下利用shell脚本测试网卡是否连通 话不多说,脚本奉上: #!/bin/bash#遍历27至28网段,查询是否能ping通该网段 for a in { ...
最新文章
- org manual翻译--3.5.8 更新表格
- php表单复选传值,jQuery+SpringMVC中的复选框选择与传值实例_jquery
- python查看文件的编码格式
- 信息收集——指纹识别
- Taro+react开发(73):Taro.createSelectorQuery
- eclipse搜索关键字
- 论文学习2-Incorporating Graph Attention Mechanism into Knowledge Graph Reasoning Based on Deep Reinforce
- DRDS SQL 审计与分析——全面洞察 SQL 之利器
- cookie session token区别_cookie、session与token的真正区别
- 希捷、西部数据硬盘保修查询
- iTunes更改备份路径
- Win系统 - 开启 WIN10 隐藏的卓越性能模式
- python 循环语句 教学设计_pythonwhile循环教案
- LaTex 编译 bib 参考文献
- 高数篇:03罗尔定理
- 对面装修,办公室放置绿萝,袋装活性炭,空气净化器,有用吗?
- 现代信息技术的特点和趋势
- linux计划任务之crontab
- 基于51单片机HX711的电子秤称重计价proteus仿真程序设计
- 沃尔沃自动驾驶卡车Vera开始在瑞典港口运货 最高时速40公里
热门文章
- 深入 Composer autoload
- 团队作业7——第二次项目冲刺(Beta版本)
- 2017.10.2 计算机算法分析----0-1背包问题
- stl空间配置器alloc
- 【转】C++连接SQL2000
- PHP cookie和session的分析
- 工作4-5年的.NET开发人员也需要有人带带才可以保证软件项目的质量
- 开启线程的几种方式、实现 Runnable 接口、实现 Runnable 接口、继承 Thread 类、FutureTask 配合 Thread
- 【Hoxton.SR1版本】Spring Cloud Gateway之Filter详解
- jeecg字典表-系统字典