- 浏览: 1041526 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (501)
- dwr (6)
- javascript (84)
- oracle (66)
- jsp/servlet (18)
- ant (3)
- 基础知识 (12)
- EXT (10)
- My SQL (10)
- java (71)
- spring (37)
- 学习的对象 (2)
- Linux (24)
- 面试 (1)
- HTML/CSS (11)
- tomcat (11)
- 收藏夹 (2)
- Power Designer (2)
- struts.xml配置文件 (1)
- sturts2 (3)
- myeclipse (8)
- eclipse (7)
- Maven (34)
- SVN (3)
- SAP JCO (2)
- JBOSS (11)
- webservice (8)
- word (1)
- 敏捷开发 (1)
- sybase (4)
- Nexus (3)
- EhCache (3)
- log4j (3)
- Cookie (4)
- Session (4)
- CXF (7)
- AXIS (2)
- SSO (1)
- LDAP (1)
- velocity (2)
- Jquery (5)
- redis (2)
- http (4)
- dojo (1)
- Linux资源监控软件mnon的安装与运用 (1)
- notepad++ (1)
- EA (1)
- UML (1)
- JasperReports (1)
- 权限 (0)
- freemarker (4)
- Spring MVC (1)
- JMS (1)
- activeMQ (1)
- hession (3)
- 安全 (1)
- ibatis (2)
- log (1)
- nginx (1)
最新评论
-
winhbb:
我刚好遇到了一个问题(在可以依赖注入的场合有效):有两个模块A ...
解决Maven项目相互依赖/循环依赖/双向依赖的问题 -
nanjiwubing123:
long3ok 写道你好 XmlOutputFormatter ...
用XStream转换复杂XML -
zhoujianboy:
另外一个方法实现eclipse tomcat 热部署:http ...
eclipse下实现maven项目在tomcat容器热部署方法 -
long3ok:
你好 XmlOutputFormatter 请问这个类是在什么 ...
用XStream转换复杂XML -
ganbo:
总结的好,文章给力。
解决Maven项目相互依赖/循环依赖/双向依赖的问题
Linux下长时间ping网络加时间戳并记录到文本
由于一些原因,比如需要检查网络之间是否存在掉包等问题,会长时间去ping一个地址,
由于会输出大量的信息而且最好要有时间戳,因此我们可以使用简单的几个shell命令组合
就可以实现:长时间ping一个地址,记录每次ping的时间戳,并输出到文本保存,另外我们
还可以将这个动作放到后台去执行,以免登陆注销之后被中断。
首先是长时间ping,这个非常简单,使用参数-c即可:
[root@test ~]# ping 192.168.2.1 -c 10
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.638 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=0.341 ms
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=0.291 ms
64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=0.259 ms
64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=0.338 ms
64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=0.339 ms
64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=0.243 ms
64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=0.234 ms
64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=0.333 ms
64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=0.284 ms
--- 192.168.2.1 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9002ms
rtt min/avg/max/mdev = 0.234/0.330/0.638/0.109 ms
上面我们ping了10次,每次的时间1秒,因此比如你要ping连天那么就是60*60*24*2=172800。
接下来是加时间戳:
root@test ~]# ping 192.168.2.1 -c 10 | awk '{ print $0"\t" strftime("%H:%M:%S",systime()) } '
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data. 10:30:21
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.436 ms 10:30:21
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=0.343 ms 10:30:22
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=0.368 ms 10:30:23
64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=0.280 ms 10:30:24
64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=0.308 ms 10:30:25
64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=0.360 ms 10:30:26
64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=0.319 ms 10:30:27
64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=0.274 ms 10:30:28
64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=0.360 ms 10:30:29
64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=0.265 ms 10:30:30
10:30:30
--- 192.168.2.1 ping statistics --- 10:30:30
10 packets transmitted, 10 received, 0% packet loss, time 9000ms 10:30:30
rtt min/avg/max/mdev = 0.265/0.331/0.436/0.052 ms 10:30:30
然后我们把信息输出到文本:
[root@test ~]# ping 192.168.2.1 -c 10 | awk '{ print $0"\t" strftime("%H:%M:%S",systime()) } '>ping.log www.2cto.com
[root@test ~]# cat ping.log
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data. 10:37:23
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.398 ms 10:37:23
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=0.288 ms 10:37:24
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=0.465 ms 10:37:25
64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=0.310 ms 10:37:26
64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=0.275 ms 10:37:27
64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=0.247 ms 10:37:28
64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=0.339 ms 10:37:29
64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=0.270 ms 10:37:30
64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=0.297 ms 10:37:31
64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=0.289 ms 10:37:32
10:37:32
--- 192.168.2.1 ping statistics --- 10:37:32
10 packets transmitted, 10 received, 0% packet loss, time 9000ms 10:37:32
rtt min/avg/max/mdev = 0.247/0.317/0.465/0.067 ms 10:37:32
最后,我们需要把任务放到后台去:
[root@test ~]# nohup ping 192.168.2.1 -c 10 | awk '{ print $0"\t" strftime("%H:%M:%S",systime()) } '>ping1.log &
[1] 2616
[root@test ~]# ls
anaconda-ks.cfg check1.sh Desktop eygle.com httpd login pass.conf ping1.log ping.log test1.sh test1.sh1 www.2cto.com
[root@test ~]# cat ping1.log
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data. 10:40:22
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.373 ms 10:40:22
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=0.343 ms 10:40:23
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=0.335 ms 10:40:24
64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=0.299 ms 10:40:25
64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=0.372 ms 10:40:26
64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=0.236 ms 10:40:27
64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=0.394 ms 10:40:28
64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=0.317 ms 10:40:29
64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=0.490 ms 10:40:30
64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=1.65 ms 10:40:31
10:40:31
--- 192.168.2.1 ping statistics --- 10:40:31
10 packets transmitted, 10 received, 0% packet loss, time 9001ms 10:40:31
rtt min/avg/max/mdev = 0.236/0.480/1.650/0.395 ms 10:40:31
-The End-
发表评论
-
日常工作linux命令
2015-08-12 07:58 627btrace –E rt 83583 com.tmall.yo ... -
/dev/zero和/dev/null的区别
2015-08-11 23:17 811http://www.cnblogs.com/jacktu/a ... -
linux top命令查看内存及多核CPU的使用讲述
2015-04-02 16:09 1016linux top命令查看内存及多核CPU的使用讲述 http ... -
Linux 的僵尸(zombie)进程
2015-04-02 16:01 583可能很少有人意识到,在一个进程调用了exit之后,该进程 并非 ... -
securecrt中使用上传下载sftp
2015-03-29 13:14 930SecureCRT这个工具自带了一个FTP,方便我们上传和下载 ... -
SecureCRT自动记录日志
2015-03-27 11:53 729http://lzj0470.iteye.com/blog/ ... -
traceroute & tracert的一些用法
2013-04-17 11:05 1764traceroute 跟踪数据包到达网络主机所经过的路由工具; ... -
PS的aux和-ef参数 .
2013-04-17 11:04 1075一直以为ps aux就可以列出所有的在运行进程,最近发现还是有 ... -
查看和修改Linux服务器的时区和时间
2012-10-25 18:39 1458本文转帖自:http://www.lidecheng.com/ ... -
linux 下 ifconfig、shutdown等命令无法使用_开启Shell命令
2012-07-13 16:31 1410为什么在 RedHat Linux 5 下不能使用 ifcon ... -
解决RedHat中ifconfig命令不能使用的问题
2012-07-12 18:55 0在RedHat中, 打开终端, 运 ... -
2011-03-22 13:43 【转】linux tar打包解压详解
2012-07-12 10:09 926tar命令 t ... -
Linux TOP命令 按内存占用排序和按CPU占用排序
2012-07-03 20:39 14641:在命令行提示符执行top命令 2:输入大写P,则结果按C ... -
Linux:挂接(mount)命令的使用方法
2011-11-21 11:05 984挂接命令(mount) 首先,介绍一下挂接(mount) ... -
chkconfig命令
2011-11-21 10:54 926[b]功能说明:检查、设定系统的各种服务。[/b] 语法 ... -
linux下root用户开启telnet
2011-11-20 21:25 1016http://www.cnblogs.com/suhuaiqi ... -
Linux中变量$#,$@,$0,$1,$2,$*,$$,$?的含义
2011-09-30 09:50 1172我们先写一个简单的脚本,执行以后再解释各个变量的意义 ... -
linux vi utf-8编码显示乱码[转载]
2011-09-16 09:04 1868解决方法:cuteftp -> 全局设置内 -> ... -
linux删除文件夹操作命令[转载]
2011-09-15 10:38 1076linux删除目录很简单,很多人还是习惯用rmdir,不过一旦 ... -
RedHat Linux 下 Tomcat开机实现自启动[转载]
2011-09-15 10:27 1635一、设置系统级环境变量: 修改/etc/profile 文件 ...
相关推荐
按需要修改地址 cscript D:\ping.vbs www.baidu.com -t -l 1024 >> D:\baidu.txt
windows 环境下 ping 加时间戳 记日志,可以把ping出来的,实时记录到txt中
windows 环境下 ping 加时间戳 记日志,可以把ping出来的,实时记录到txt中
压缩包内有使用说明,根据说明步骤即可实现ping日志增加时间戳。
tcping命令可以ping禁ping网站,电脑可能不能直接运行还要下一个tcping64的模块放system里面
带时间戳ping命令,方便用户诊断断网的时间是什么时候,有效协作诊断网络问题。运行后生成的文件位于D盘1213.txt 文件
两个文件一个是vbs源码,可以自己研究一个是一件用工具打包的exe。主要用来在win系统下得到带时间戳的ping记录,网工监测网络使用。运行后会得到一个黑框。。关掉黑框代表停止运行。欢迎改良
一般的ping命令不带时间戳,这个加强版可以形成日志记录。便于网络稳定性长期监控。
ping命令加时间并记录日志,网络故障排查好工具
可支持win7的ping增加时间戳的脚本,支持多ip自动输出ping结果
带时间戳的Ping+文件保存记录,可要据用户需要将指定网络的检测结果保存在指字件中,主要用于网络稳定性的持续检测及观察!
Linux查看History记录加时间戳小技巧 熟悉bash的都一定知道使用history可以输出你曾经输入过的历史命令,例如 [root@servyou_web ~]# history | more 6 ./test.sh 7 vim test.sh 8 ./test.sh 但是这里只显示了...
带时间戳的ping工具 是一个在windows环境下运行的脚本,输入对端地址就可以开始ping,有日志记录功能。
Linux登录日志时间戳转换工具,主要用于Linux系统登录分析,方便溯源。
打开cmd使用ping命令是不带时间戳的,要检测网络在某个时间段出现网络波动导致丢包的时候,需要一个时间戳做记录,因此需要使用到以下方式
可以增加多条IP地址ping服务器 可以自动产生日志文件,在日志文件中增加时间戳 方便简单
是一个脚本性质的PING工具,不需要安装。自动保存记录,且每一条都带了时间戳。
点击获取当前时间的时间戳并保存到日志文件,带简单图形界面
超级 Ping 监测工具——为您的网络状态保驾护航 cmd.exe 版本6.1.7601.17514 可完美运行 软件运行效果如下 _____________sping.cmd written by liuying_____________ ==========================================...