Linux:
While:;d o ping-c 1 172.16.128.36|awk '/ttl=/' |sed ' s/^/' date +%y-%m-%d\|%t '/'; sleep 1;done
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Network/wgzs/
Execution results
2011-03-08|15:55:49 bytes from 172.16.128.6:icmp_seq=0 ttl=252 time=0 ms
2011-03-08|15:55:50 bytes from 172.16.128.6:icmp_seq=0 ttl=252 time=0 ms
2011-03-08|15:55:51 bytes from 172.16.128.6:icmp_seq=0 ttl=252 time=0 ms
2011-03-08|15:55:52 bytes from 172.16.128.6:icmp_seq=0 ttl=252 time=0 ms
Windows:
''
"Use method
'; cscript ping.vbs 192.168.1.1-t-L 1000
''
Dim args, flag, unsuccout
Args= ""
Otherout= ""
Flag=0
If WScript.Arguments.count = 0 Then
WScript.Echo "Usage:cscript Ping.vbs [-t] [-a] [-N Count] [-l size] [-f] [-I TTL] [-v TOS]"
WScript.Echo "[-S count] [[-j host-list] | [k Host-list]] "
WScript.Echo "[-R Count] [-w timeout] destination-list"
Wscript.Quit
End If
For I=0 to Wscript.arguments.count-1
Args=args & "" & WScript.Arguments (i)
Next
Set shell = WScript.CreateObject ("Wscript.Shell")
Set re=new REGEXP
Re. Pattern= "^reply|^request"
Set Myping=shell. Exec ("ping" & args)
While not myping. Stdout.atendofstream
Strline=myping. Stdout.readline ()
R=re. Test (StrLine)
If R Then
WScript.Echo Date & "" & Time & Chr (9) & StrLine
Flag=1
Else
Unsuccout=unsuccout & StrLine
End If
Wend
If flag = 0 Then
WScript.Echo Unsuccout
End If
Save into Tping.vbs
Executes the cscript tping.vbs under command
Output results
2005-9-14 12:02:01 Reply from 192.168.0.249:bytes=32 time<10ms ttl=64
2005-9-14 12:02:02 Reply from 192.168.0.249:bytes=32 time<10ms ttl=64
2005-9-14 12:02:03 Reply from 192.168.0.249:bytes=32 time<10ms ttl=64
2005-9-14 12:02:04 Reply from 192.168.0.249:bytes=32 time<10ms ttl=64
If you want to save for a long time, then redirect to the file >