When running in Domain mode using the CLI can be tricky as you have to understand where your resources are located in the application server tree. Let's see some practical examples:

How to configure a resource in a Domain

You have to reference the profile you are using. Example:


How to reach a resource available on a server

Some resources (notably datasources and JMS destinations) produce statistics on the server where they are available. Thus you have to reach the server node through the host:


Handling server start/stop/restart/reload

How to start all server groups:


How to restart all server groups:


How to stop all server groups:


How to reload all server groups:


A practical script for shutting down a domain (remember shut down the slave host at first!)

./jboss-cli.sh --connect controller= /host=slave:shutdown
./jboss-cli.sh --connect controller= /host=master:shutdown

How to un-assign an application from a Server Group


How to remove an application from the Repository


A practical bash script for deploying one application (pass the application as argument)

./jboss-cli.sh --connect controller= --commands="undeploy $1 

And to undeploy the application (pass the application as argument)

./jboss-cli.sh --connect controller= --commands="deploy $1 

Related articles available on mastertheboss.com

How do I get the list of MBeans with twiddle?

  JBoss provides a simple command line tool that allows for inte

How to count active session with twiddle ?

  There are some well known alternatives to count the number of

How do I run garbage collector from shell?

  You can suggest JBoss to run the garbage collector in differen

How do I check my application status from shell?

  This is a two process step: at first you need to retrieve the

How do you shut down multiple JBoss instances?

  Supposing you have configured 2 instances of JBoss, one on por

twiddle reference guide

Please note: twiddle is not available any more as default Command