The previous article was about installing TomEE SSH connector. Let’s now see which commands are available by default in details.
cat command is highly inspired from unix cat command. You add a file path and the command prints its content.
To avoid to be able to access the whole file system files you have to start the provided path by $base or $home which are the CATALINA_HOME or CATALINA_BASE variable of your TomEE.
Example: cat $home/conf/server.xml
classloader command let you print what is in classloaders of an application. You have to provide the application id after the command name. Don’t panic if you don’t know it, simply write “classloader” and the command will print all the application ids.
Example: classloader MyWebapp
deploy command simply let you deploy an application from a path.
Example: deploy /opt/apps/my-app.war
Note: if you have added the provisioning module you can use maven like path (deploy com.foo/foo-web/1.0.0/war)
undeploy command simply let you undeploy a deployed application from a path.
Example: undeploy /opt/apps/my-app.war
Note: same note than for deploy applied you can use maven path or http urls under the same constraints.
apps command is a simple command to print all deployed applications. It prints all ids.
exit is not surprising, it simply close the session.
help command prints all available commands, their name, description and usage
list command prints all deployed EJBs with their type, class and name.
jmx commands let’s you interact with local MBeans.
It has several sub commands.
Query a value. Parameters are the attribute name and the objectname.
Example: jmx get MyAttributeName foo:type=bar
Update a value. Parameters are the attribute name, the objectname and the new value.
Example: jmx set MyAttributeName foo:type=bar NewValue
Invoke a method. Parameters are the method with its parameters and the object name.
Example: jmx invoke myMethod(arg1,arg2) foo:type=bar”)
list simply list all mbeans.
Example: jmx list
Like the UNIX command ls list files/directories in a folder. The same contraint then for cat command is applied: you have to use $ase and $home variables.
Example: ls $home/conf
Part is a bit particular since it lets you print a segment of a file. You simply have to provide the segment <first line>-<last-line> and the path of the file (starting with $home or $base).
Example: part 3-10 $home/conf/catalina.properties
properties command dumps the TomEE configuration in properties format.
script command lets you use the JSR 223 (scripting for the JVM) to do some stuff using ejbs (from their names) or CDI beans. For CDI beans you need to use the “bm” variable. bm object has the following methods:
- beanFromClass(appname, classname)
- beanFromName(appname, beanname)
You have to give the language to use as first parameter then the script itself.
Example: script groovy print ‘ok’
Close to script command, script file takes a file as parameter, determine the script language from the extension and execute it.
Example: script file my-script.js