Deploy Bundle for Simple Shell Script?
I'd like to deploy a bundle to servers with a RHQ Agent installed to execute a shell command or run a shell script, but I'm a bit confused on how to do this after looking at the documentation.
Could someone provide an example deploy.xml or provide some direction on how to accomplish this?
Thanks.
Responses
To make sure that I understand, you are wanting to simply execute some command on a target platform by deployment a JBoss ON provisioning bundle?
Basically, you will use Ant's Exec Task in a preinstallTarget or postinstallTarget target.
...
<rhq:bundle name="example-exec-bundle" version="1.0" description="A sample bundle demonstrating the use of the Ant exec task">
<rhq:deployment-unit name="onlypretarget" preinstallTarget="executeCommand" compliance="filesAndDirectories">
...
</rhq:deployment-unit>
</rhq:bundle>
...
<target name="executeCommand">
<exec executable="ls" outputproperty="ls.out">
<arg value="-l"/>
<arg value="${rhq.deploy.dir}"/>
</exec>
...
</target>
Hope that helps.
You can use the bundle task rhq:audit to produce output/status information that will appear in the bundle deployment status/detail view. For example:
<rhq:audit status="SUCCESS" action="Run ls Command" info="Executed ls ${rhq.deploy.dir}" message="Output from ls command: ${ls.out}">
</rhq:audit>
If you have more details you can also add them as the content of the rhq:audit element.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
