Shell script (status.sh) bellow returns three jboss server state :

Use :

> ./status.sh /path/to/jbossHome

This script may be improved … Also you need to replace in code myArtifactName fake value by your right value

#!/bin/bash

res=$($1/bin/jboss-cli.sh --commands="connect,read-attribute server-state" 2>&1)

if [[ $res != 'running' ]]
then
        echo "STOPPED ($res)"
else
        artifactDeployed=$($1/bin/jboss-cli.sh --commands="connect,deploy -l" | grep myArtifactName | grep OK  2>&1)
        if [[ X$artifactDeployed == 'X' ]]
        then
                echo "STARTING ($res / $artifactDeployed)"
        else
                echo "RUNNING ($res / $artifactDeployed)"
        fi
fi