Book Image

Wildfly Cookbook

Book Image

Wildfly Cookbook

Overview of this book

Table of Contents (23 chapters)
WildFly Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Invoking CLI commands


In this recipe, you will learn how to invoke CLI commands directly from your command line without accessing the CLI itself, let's say not in an interactive way. This technique might be helpful in case you have to script some processes, like stopping and starting servers in a sequence, deploying an application only if another one has already been deployed, and so on. Often times, you also need to monitor some state, thus you just need that number (as typically seen in Nagios).

Getting ready

Remember I'm running WildFly remotely, bound to 192.168.59.103 as IP. WildFly is already up and running.

How to do it…

On your local PC, open a new terminal window and run the following commands:

$ cd $WILDFLY_HOME
$ ./bin/jboss-cli.sh -c --controller=192.168.59.103:9990 --user=wildfly --password=cookbook.2015 --command=":read-attribute(name=release-codename)"
{
    "outcome" => "success",
    "result" => "Kenny"
}

Obviously, you can extract just the information you need by using...