How to detect if a Windows app dies??

Hello All: I hope this is the right category...
I have a application (this app runs under java and jboss) that runs under Windows, it's started as a service. If that application should become disabled, crash or no longer function, what would be the best method for determining it is no longer running? If this was UNIX it would be a no-brainer I could simply watch for the pid or write a script to tickle the app. I don't think I have that luxury on Windows (Sever 2003,2000, XP)

Again Thanks all

Actually, believe it or not you do have pid, but I have no great experience of windows, but I would expect that there is something in the APIs to get PIDs. My main concern would be ( from the last time I had to work with windows ) is that is is very difficult to get that kind of information after the fact if the process does not itself open a window.

You mention services. You can use net start to see if your service is currently up or not.

Difficult - yes.
Very difficult - probably.

If you want to go down this way, you should look at the toolhelp32 api or use the psapi library. There are a couple of other ways as well. See Alex Fedotov's write up on the same.

Thanks All: Our customer has asked for this request but it doesn't seem to be a "hot" topic for them. I'll go down that road if it becomes more of a issue. One thing I might be able to do,... Our application opens tcpip ports. I could poll that port ever 15 minutes if its gone then I might have a pretty good idea our app is toast. A netstat -a and search for our IP port "should" be pretty simple. I'll look into "net start" and see what that offers.

Hay... this is a GREAT site Keep up the good work !!!!

Could you make a persistent connection, and wait for it to close?

Hmm.. Good suggestion I'll have to think about that. Meanwhile.. I was looking at net start This may work... Cool :slight_smile: Thx Vino