How to shut down WildFly remotely?

To shut down JBoss or WildFly remotely, you can use the JBoss Command Line Interface (CLI) or the Management REST API. In this tutorial we will show both approaches.

Two ways to shutdown JBoss or WildFly remotely

If you have a local JBoss/WildFly installation then you can use the local jboss-cli.sh script to connect to the remote WildFly application server.

For example:

./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server
[disconnected /] connect 192.168.0.10:9990
Connected to standalone controller at 192.168.0.1:9990

Next, issue the shutdown command:

shutdown

Please note that you can also issue a server restart, if you want. Read the following article to learn more:  How to Start, Stop and Restart WildFly

On the other hand, if you don’t have a local WildFly installation you can use the HTTP Management API. For example, with curl execute the following command:

curl --digest http://192.168.10.1:9990/management --header "Content-Type: application/json" -u admin:admin -d '{"operation":"shutdown","blocking":true}'

In the above example, we are shutting down the remote server running on 192.168.10.1 using the credentials admin/admin.

Choose the method that best suits your requirements and access capabilities, and use it to gracefully shut down JBoss or WildFly remotely.

Found the article helpful? if so please follow us on Socials