How can I tell when tomcat is finished starting? (controlling the service with C#)
I'm writing a C# application to control the windows tomcat service. I need a way to get some sort of event when tomcat finishes starting after I run the service. (i.e. all the apps deploy.)
I can read the log file and wait for the "Server startup in" message but it seems like there must be a less messy way. I know you can register a lifecycle listener using Java but I can't think of a way to do something similar with C#.
Does anyone know a good way to monitor tomcat with C#? Thanks in advance.
Edit: In case I wa开发者_如何学运维sn't clear, simply checking the status of the isn't sufficient since it will report "Running" during the startup time while the apps are being deployed and it isn't yet accessible.
Unless there's a reason you can't do so (permissions, etc) I would just issue a web request to the service and wait until it comes back.
Even if you don't want to give the account hosting the service permission to use the app(s) in question, you can still create an app that only it has permission to use, and have it call that.
I ended up writing a tomcat wrapper in Java which acts as a lifecycle listener. The C# application launches the java program and receives lifecycle messages through a named pipe.
精彩评论