https://issues.apache.org/bugzilla/show_bug.cgi?id=51587
Bug #: 51587 Summary: Implement status and uptime commands Product: Tomcat 7 Version: unspecified Platform: PC OS/Version: Windows XP Status: NEW Severity: enhancement Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: knst.koli...@gmail.com Classification: Unclassified In Tomcat HowTo wiki it is mentioned that it would be nice to have "status" and "uptime" commands in Tomcat. [1] [1] http://wiki.apache.org/tomcat/HowTo#How_do_I_check_whether_Tomcat_is_UP_or_DOWN.3F_There_is_no_status_command My thoughts on implementing it are the following: 1. Create a Listener class "TomcatStatusListener" and add it to server.xml. 2. The class will implement a non-daemon waiting loop, like the one implemented in StandardServer.await. One of issues in StandardServer.await is that it starts listening on a port only after Tomcat startup completes. If it fails to open the port (e.g. another Tomcat instance is running) it shuts down Tomcat, but I think that it happens too late. (*) The listener can start listening on the port earlier. (*) existing workarounds are using CATALINA_PID setting in catalina.sh/setenv.sh and configuring o.a.c.s.EXIT_ON_INIT_FAILURE system property. 3. The control port and shutdown command for the listener can be read from the StandardServer object. After that the await behaviour of the server can be disabled by programmatically changing StandardServer.port to a negative value. I think that there is some undocumented code for the value of -2 there already, or we can add some additional explicit flag to the StandardServer object. Note, that when shutting down Tomcat the port number is being read from port attribute on the Server element. The code wouldn't look for the listener implementations, so there would not be much sense in specifying a different port on the Listener element. 4. Implement additional commands, "status" and "uptime" in the listener. The "status" command can print the value of StandardServer.getStateName(). It might be done that the output of the "status" command were enhanceable. E.g. some structured data (status, uptime, start date) - compare with comment 7 in bug 49395. It is up to the other side of control port connection to interpret the value and print a more human-friendly message. E.g.: Tomcat Status: STARTED, 13:0:14, 2011-07-30T11:51 Running. Started on July 20, 2011 11:51. Uptime 13 day(s) 0 hour(s) 14 minute(s). 5. If shutdown is implemented by the listener, it would be possible to initiate shutdown before Tomcat fully starts up. 6. If there is no such listener in server.xml, the behaviour remains the same as earlier with await loop being run by StandardServer. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org