Buscar este blog

domingo, 6 de agosto de 2017

Tomcat Manager - Commands cheat sheet

Tomcat rest commands: https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Supported_Manager_Commands


First, you need to create a user with the manager-script role. The complete list of available roles can be found in $TOMCAT_HOME/webapps/manager/WEB-INF/web.xml:
  • manager-gui — Access to the HTML interface.
  • manager-status — Access to the "Server Status" page only.
  • manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
  • manager-jmx — Access to JMX proxy interface and to the "Server Status" page.

Then, you need to assign this role to a user. Users are configured en $TOMCAT_HOME/conf/tomcat-users.xml:
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-status"/>
  <role rolename="manager-jmx"/>
    
  <user username="admin"  password="admin"  roles="manager-gui"/>
  <user username="admins" password="admins" roles="manager-script"/>
</tomcat-users>

Finally, use curl tool:
curl -u admins:admins http://localhost:8080/manager/text/serverinfo

curl -u admins:admins http://localhost:8080/manager/text/list

curl -u admins:admins http://localhost:8080/manager/text/sessions?path=/examples
curl -u admins:admins http://localhost:8080/manager/text/start?path=/examples
curl -u admins:admins http://localhost:8080/manager/text/stop?path=/examples
curl -u admins:admins http://localhost:8080/manager/text/reload?path=/examples


No hay comentarios:

Publicar un comentario