无码视频在线观看,99人妻,国产午夜视频,久久久久国产一级毛片高清版新婚

  • 始創(chuàng)于2000年 股票代碼:831685
    咨詢熱線:0371-60135900 注冊(cè)有禮 登錄
    • 掛牌上市企業(yè)
    • 60秒人工響應(yīng)
    • 99.99%連通率
    • 7*24h人工
    • 故障100倍補(bǔ)償
    全部產(chǎn)品
    您的位置: 網(wǎng)站首頁(yè) > 幫助中心>文章內(nèi)容

    Linux下長(zhǎng)時(shí)間ping網(wǎng)絡(luò)加時(shí)間戳并記錄到文本

    發(fā)布時(shí)間:  2012/9/15 20:53:39
    由于一些原因,比如需要檢查網(wǎng)絡(luò)之間是否存在掉包等問(wèn)題,會(huì)長(zhǎng)時(shí)間去ping一個(gè)地址,由于會(huì)輸出大量的信息而且最好要有時(shí)間戳,因此我們可以使用簡(jiǎn)單的幾個(gè)shell命令組合就可以實(shí)現(xiàn):長(zhǎng)時(shí)間ping一個(gè)地址,記錄每次ping的時(shí)間戳,并輸出到文本保存,另外我們還可以將這個(gè)動(dòng)作放到后臺(tái)去執(zhí)行,以免登陸注銷之后被中斷。
    首先是長(zhǎng)時(shí)間ping,這個(gè)非常簡(jiǎn)單,使用參數(shù)-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次,每次的時(shí)間1秒,因此比如你要ping連天那么就是60*60*24*2=172800。
    接下來(lái)是加時(shí)間戳:
    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
    [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
    最后,我們需要把任務(wù)放到后臺(tái)去:
    [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
    [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-
     

    本文出自:億恩科技【mszdt.com】

    服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經(jīng)營(yíng)性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經(jīng)營(yíng)性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經(jīng)營(yíng)性ICP/ISP證:贛B2-20080012
  • 服務(wù)器/云主機(jī) 24小時(shí)售后服務(wù)電話:0371-60135900
  • 虛擬主機(jī)/智能建站 24小時(shí)售后服務(wù)電話:0371-60135900
  • 專注服務(wù)器托管17年
    掃掃關(guān)注-微信公眾號(hào)
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權(quán)所有  地址:鄭州市高新區(qū)翠竹街1號(hào)總部企業(yè)基地億恩大廈  法律顧問(wèn):河南亞太人律師事務(wù)所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號(hào)
      1
     
     
     
     

    0371-60135900
    7*24小時(shí)客服服務(wù)熱線