How to check that WildFly is running using the Command Line Interface

In order to check the server status using the CLI, just connect to the management interface and query for the server-state attribute as follows:

./jboss-cli.sh -c 
[standalone@localhost:9999 /] :read-attribute(name=server-state) 
{
    "outcome" => "success",
    "result" => "running"
}

 If you want to check the status from your shell, maybe as part of a script, then you can use the CLI and extract just the server status using a tool like awk. Check the following example:

$ ./jboss-cli.sh -c --controller=localhost:9990 --user=admin --password=Password1! --command=":read-attribute(name=server-state)" | awk 'NR==3 { print $3 }'

"running"