I have to check a server is up or not by Firing certain URL. I tried using wget command,where there is a response like "HTTP request sent, awaiting response... 200 OK " is coming which shows the server is up and running.but i cant return the status to make it automate. I have a list of 10 URL which i have to nake it automate to check all the URL are responding properly or not. please help.
Asked
Active
Viewed 420 times
-1
-
You should take a look at [ask] and [mcve] – pvg Jun 30 '17 at 07:31
-
You can consider to use curl - https://stackoverflow.com/questions/6136022/script-to-get-the-http-status-code-of-a-list-of-urls – ajreal Jun 30 '17 at 07:36
-
After running the command check the exit code. A non-zero value indicates failure. – shanmuga Jun 30 '17 at 07:40
1 Answers
0
This is literally it:
if curl https://example.com
then
echo "up"
else
echo "down"
fi

l0b0
- 55,365
- 30
- 138
- 223