I'm fairly new to JBoss and I was trying to figure out how to administer JBoss via scripting. One word: twiddle. I did not find a lot of documentation or examples posted and for some reason I could not get it through my fat head. Anyhow, here's my explanation and a couple of examples:
twiddle is the command line/scripting way to do everything you do in the jmx-console GUI.
All you have to know is the syntax to communicate with a particular MBean. With twiddle you can get information about your server, query the server for MBeans, get the attributes of a particular MBean, invoke operations on an MBean, etc. Until I got used the various functions, I used the jmx-console to SEE the various domains, Mbeans and operations and then write the corresponding twiddle command for what I wanted to do.
Here's some examples:
Stop and Start an application
./twiddle.sh invoke jboss.web.deployment:id=-#######,war=your-app.war stop
./twiddle.sh invoke jboss.web.deployment:id=-#######,war=your-app.war start
Note: ####### is unique to your environment
Dump the JNDI NameSpace
./twiddle.sh invoke jboss:service=JNDIView list true
Query the server for a list of MBeans matching service=invoker*
./twiddle.sh -s your-server-name query 'jboss:service=invoker,*'
Grab the state (started, stopped) of the httpInvoker
./twiddle.sh get jboss:service=invoker,type=http StateString