title: Ping Tool to check if server is online
body: <p>Is this tool that I created from various SOF threads valid?  Will it work?  I want to have a ping test done to a server every minute.  If it fails 5 times in a row it sends an email out.  It then flushes and resets the script pretty much to check again.</p>
  
  <pre><code>#!/bin/bash
  # ping checker tool
  
  numOfFails=0
  incrememnt=1
  EMAILMESSAGE="/tmp/emailmessage.txt"
  
  while true; do
      if ! ping -c 1 google.com ; then #if ping exits nonzero...
          numOfFails=$(($num + $increment))
      else
          numOfFails=0
      fi
      if ((numOfFails &gt; 4)); then
          numOfFails=0
          echo "SAN is offline!" &gt; $EMAILMESSAGE
          mail -s "SAN offline" "test@test.com" &lt; $EMAILMESSAGE
      fi
      sleep 60 #check again in one minute
  done
  </code></pre>