Yes. If you run this script and checksitestatus.sh and use http://google.com it'll say site is up. If you type http://googlex.com it'll say site is down.
You would have to install lynx to from the repository with:
$ sudo apt-get install lynx
The script (checksitestatus.sh):
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'Missing parameter - site to check... exiting.'
exit 0
fi
site=$1
siteisdown=$(lynx -dump $site 2>&1 | egrep 'Alert!: Unable to connect to remote host.')
if [[ "$siteisdown" ]]
then
echo "Site is down"
# any other code here
else
echo "Site is up"
# any other code here
fi
Yes. If you run this script and
checksitestatus.sh
and usehttp://google.com
it'll saysite is up
. If you typehttp://googlex.com
it'll saysite is down
.You would have to install
lynx
to from the repository with:The script (checksitestatus.sh):