title: How to check if a server is running
body: <p>I want to use ping to check to see if a server is up. How would I do the following:</p>
  
  <pre><code>ping $URL
  if [$? -eq 0]; then
      echo "server live"
  else
      echo "server down"
  fi
  </code></pre>
  
  <p>How would I accomplish the above? Also, how would I make it such that it returns 0 upon the first ping response, or returns an error if the first ten pings fail? Or, would there be a better way to accomplish what I am trying to do above?</p>