Scripts and variables with jboss-cli.sh

jboss-cli.sh is a command line tool that allows the administrator to perform many tasks at once with JBoss or Wildfly.

Sometimes, users wants to use variables to input values, see how to use variables with jboss-cli.sh

DSNAME=ExampleDS

cmd=`cat <<EOF 
/host=master/server=server-one/subsystem=datasources/data-source=$DSNAME:test-connection-in-pool,
version
EOF`

echo "cmd="$cmd

/opt/jboss-eap-6.3/bin/jboss-cli.sh -c --commands="$cmd"

The above sample, adds a variable named DSNAME.

See, each line ends with a comma, it is the command separator, when –commands is used.

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *