【Ping】unix - ping命令的退出状态
生活随笔
收集整理的這篇文章主要介紹了
【Ping】unix - ping命令的退出状态
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原文:
If ping does not receive any reply packets at all it will exit with code 1.
If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1.
On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.
谷歌翻譯:
如果ping根本沒有收到任何回復數據包,它將退出代碼1。
如果指定了數據包計數和截止日期,并且在截止日期到達時收到的包數量少于計數數據包,則也會以代碼 1 退出。
在其他錯誤中,它與代碼2一起退出。否則它將退出代碼0。這使得使用退出代碼查看主機是否還活著成為可能。
總結
以上是生活随笔為你收集整理的【Ping】unix - ping命令的退出状态的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Prometheus + Grafan
- 下一篇: 【Rsyslog】 从json 中通过正