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...")
 
mNo edit summary
 
Line 1: Line 1:
<metadesc>Just a simple check to see if something is pingable.  This can be used to make simple monitors.</metadesc>
<pre>
<pre>
check_remote() {
check_remote() {

Latest revision as of 15:01, 25 April 2024

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
}