tomcatmanager is a command line tool and python library for managing a Tomcat server.

What Can It Do?

This package installs a command line utility called tomcat-manager. It’s easily scriptable using your favorite shell:

$ tomcat-manager --user=ace --password=newenglandclamchowder \
http://localhost:8080/manager deploy local sample.war /sampleapp
$ echo $?

There is also an interactive mode:

$ tomcat-manager
tomcat-manager>connect http://localhost:8080/manager ace newenglandclamchowder
--connected to http://localhost:8080/manager as ace
Path                     Status  Sessions Directory
------------------------ ------- -------- ------------------------------------
/                        running        0 ROOT
/sampleapp               stopped        0 sampleapp##9
/sampleapp               running        0 sampleapp##8
/host-manager            running        0 /usr/share/tomcat8-admin/host-manage
/manager                 running        0 /usr/share/tomcat8-admin/manager

And for the ultimate in flexibility, you can use the python package directly:

>>> import tomcatmanager as tm
>>> tomcat = tm.TomcatManager()
>>> r = tomcat.connect(url='http://localhost:8080/manager',
... user='ace', password='newenglandclamchowder')
>>> tomcat.is_connected
>>> r = tomcat.stop('/someapp')
>>> r.status_code == tm.status_codes.ok
>>> r.status_message
'No context exists named /someapp'

System Requirements

You’ll need Python 3.5 or higher on macOS, Windows, or Linux.

The following Tomcat versions are supported:

  • 7.0.x
  • 8.0.x
  • 8.5.x
  • 9.0.x