-
1. Re: Can I declare variable in CLI script?
splusk Oct 17, 2013 5:38 AM (in response to spbhosale)We use --properties=<yourproperty.properties> argument when starting the CLI.
For example:
./jboss-cli.sh -c --file=myscript.cli --properties=mysettings.properties
mysettings.properties file:
db.url=jdbc:oracle:thin:@auckland:1521:lmnop
db.user=test
db.password=secret
myscript.cli file
/subsystem=datasources/data-source=ExampleDS:add(jndi-name=java:jboss/datasources/WebDS,connection-url=${db.url},user-name=${db.user},password=${db.password},use-java-context=true,driver-name=OracleJDBCDriver,enabled=true)
Note:
- Test on jboss-eap-6.1
- It does have some limitations (for example adding modules, with variables cannot be done AFAIK)
-
2. Re: Can I declare variable in CLI script?
ssilvert Oct 17, 2013 7:38 AM (in response to splusk)Also, if you need the power of a full language you can use any JVM scripting language. See Advanced CLI scripting with Groovy, Rhino, Jython, etc.
Stan
-
3. Re: Can I declare variable in CLI script?
spbhosale Oct 17, 2013 8:36 AM (in response to splusk)My result is as:
jboss-cli.bat --connect --file=updateStandaloneFull.cli --properties=variables.properties
O/p:
Only one of '--file', '--commands' or '--command' can appear as the argument at a time.
Press any key to continue . . .
-
4. Re: Can I declare variable in CLI script?
splusk Oct 17, 2013 8:50 AM (in response to spbhosale)aahhh seems to be my mistake, it doesn't look like --properties flag is supported on AS-7, can you use an eap version?
-
5. Re: Can I declare variable in CLI script?
mschwery Oct 25, 2013 4:05 PM (in response to splusk)I tried doing the same thing with the following command but JBoss didn't like it.
/subsystem=messaging/hornetq-server=default/jms-queue=MyQueue1/:add(entries=${var.queueName},durable=false)
Got any ideas?
-
6. Re: Can I declare variable in CLI script?
splusk Oct 29, 2013 5:03 AM (in response to mschwery)Hi,
What do you mean didn't like it? -
7. Re: Can I declare variable in CLI script?
mschwery Oct 29, 2013 1:24 PM (in response to splusk)When I try the following line I get an "Can't proceed with node type system-property until the node name for the previous node type has been specified" error.
/subsystem=messaging/hornetq-server=default/jms-queue=system-property=propertyname:read-attribute(name="var.queueName")/:add(entries=[system-property=propertyname:read-attribute(name="var.queueNameExport")],durable=false)
-
8. Re: Can I declare variable in CLI script?
splusk Nov 7, 2013 4:48 AM (in response to mschwery)Hi,
If you connect to jboss-cli and type /subsystem= (and then tab out) do you see messaging as a completion option? If not you will need to add it first
see
https://community.jboss.org/wiki/AddingANewExtensionSubsystemViaTheCLI