Bash Script to Check for a "200 ok" http reply no longer working
Up until recently I used this code on Centos 5 servers as part of a more complex program to determine if a URL gives a 200 OK reply (exists) or if it doesn't...
usage: sh scriptname website
(where someurl would be a proper url)
lynx -dump "$website" &> /dev/null
if [[ $? -eq 0 ]]; then
echo Web Page Exists
echo Web Page Doesnt exist
Trying this on modern Debian 6.0 and latest Ubuntu doesn't work. It produces an output that isn't silent at all... it tries to open alternative web pages and it doesn't give a reliable response.
What options can I use with lynx to make it work like the old lynx? and if not...
What other methods can I use in bash to check if a URL gives a 200OK response or not?
Any Help or Ideas are greatly appreciated...