openquestion
openquestion

Reputation: 1023

how to check wheather application is up & running in the server?

I want to check whether application up & running or down , because of some error in the application. I can able to monitor server using process ID , but there is possible application down but server up & running.

I want to monitor the application URL , like http://10.1.1.1:8080/test. i can't ping the url , because its not an DNS server.

So how to monitor the application url whether is working good or some error occur. Please advise...

Upvotes: 1

Views: 714

Answers (1)

Adam
Adam

Reputation: 36743

I'd do this with wget. You need to configure it with number of attempts to try, and I'd recommend a low-ish timeout value too, whatever you think an acceptable response is. It will return 0 if it could download the page and non-zero otherwise.

#!/bin/sh

if wget "$1" -O /dev/null --tries 1 --quiet --timeout 5; then echo "Up"; else echo "Down"; fi

Example

check-site.sh "http://10.1.1.1:8080/test"

Upvotes: 1

Related Questions