Checking host availability by using ping in bash scripts

前端 未结 8 2147
-上瘾入骨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:30

    up=`fping -r 1 $1 `
    if [ -z "${up}" ]; then
        printf "Host $1 not responding to ping   \n"
        else
        printf "Host $1 responding to ping  \n"
    fi
    

提交回复
热议问题