Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Windows 7, and I have a remote Linux machine that runs a Java application in Tomcat (on port 8080). Sometimes, the remote machine is up but Tomcat doesn't respond.

How can I code something that will check if it is up periodically (e.g. every 10 minutes) and somehow warn me?

share|improve this question

2 Answers 2

Install curl

http://curl.haxx.se/download.html

Then you can use the curl command on your tomcat URL on port 8080 to see if it is working.

Or you can just use telnet server 8080.

share|improve this answer

I have developed a VBS script which you can schedule in Windows Scheduler to run in 10 minute intervals

The script when executed tries to connect to the URL given as its first argument. If it is not able to connect, it will popup a message box saying "Could not connect".

Here is the source code:

If WScript.Arguments.Count <> 1 then
  Wscript.Echo "Usage: CheckTomcat.vbs URL"
  wscript.Quit
End If 

URL = WScript.Arguments.Item(0)

Set Http = CreateObject("Microsoft.XmlHttp")
Http.open "GET", URL, FALSE

On Error Resume Next
Http.Send ""

If Err.Number <> 0 Then
    Wscript.Echo "Cannot connect to Tomcat at " & URL
    Wscript.Quit 1
End If

'WScript.Echo "Connection successful. Response Code is " & Http.Status

Set Http = nothing
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.