How to run a WildFly CLI command from shell

In order to run a WildFly CLI command from your OS shell, just pass it as parameter after the –connect option.

Example:

$JBOSS_HOME/bin/jboss-cli.sh --connect "/profile=default/subsystem=logging/logger=*:read-resource"

If you need to provide Username/Password on the command line, you can use the following options:

$JBOSS_HOME/bin/jboss-cli.sh --connect controller=$JBOSS_IP:9990 --user=$USER --password=$property_value --command="/subsystem=logging:read-resource"