Reputation: 5563
I would like to write a script to check whethere the application is up or not using unix shell scripts.
From googling I found a script wget -O /dev/null -q http://mysite.com
, But not sure how this works. Can someone please explain. It will be helpful for me.
Upvotes: 1
Views: 3274
Reputation: 32392
wget
command-O
option tells where to put the data that is retrieved/dev/null
is a special UNIX file that is always empty. In other words the data is discarded.-q
means quiet. Normally wget prints lots of info telling its progress in downloading the data so we turn that bit off.http://mysite.com
is the URL of the exact web page that you want to retrieve. Many programmers create a special page for this purpose that is short, and contains status data. In that case, do not discard it but save it to a log file by replacing -O /dev/null
with -a mysite.log
.
Upvotes: 4
Reputation: 57690
Check whether you can connect to your web server.
See this shell script.
if wget -O /dev/null -q http://shiplu.mokadd.im;
then
echo Site is up
else
echo Site is down
fi
Upvotes: 2