Bash-check-if-host-pingable

From I Will Fear No Evil
Revision as of 16:17, 15 October 2021 by Chubbard (talk | contribs) (Created page with "<pre> check_remote() { local VALIDATE=`ping -c 3 ${IP} >/dev/null 2>&1; echo $?` if [ ${VALIDATE} -eq 0 ];then echo "Failure: IP address ${IP} is still pingable!"; exit 2 el...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
check_remote() {
local VALIDATE=`ping -c 3 ${IP} >/dev/null 2>&1; echo $?`
if [ ${VALIDATE} -eq 0 ];then
  echo "Failure: IP address ${IP} is still pingable!"; exit 2
else
  echo "Confirmed: IP address ${IP} is not pingable."
fi
}