Checking host availability by using ping in bash scripts

前端 未结 8 2125
-上瘾入骨i
-上瘾入骨i 2020-11-29 20:07

I want to write a script, that would keep checking if any of the devices in network, that should be online all day long, are really online. I tried to use ping, but

8条回答
  •  粉色の甜心
    2020-11-29 20:08

    FYI, I just did some test using the method above and if we use multi ping (10 requests)

    ping -c10 8.8.8.8 &> /dev/null ; echo $?

    the result of multi ping command will be "0" if at least one of ping result reachable, and "1" in case where all ping requests are unreachable.

提交回复
热议问题