Bash-check-if-host-pingable: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 16:17, 15 October 2021

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
}