08 February 2007

OPMN event-scripts

A nifty little feature of OPMN is the ability it has to launch scripts at certain points in its management of processes -- pre-start, pre-stop and post-crash -- giving you the ability to perform any sort of management tasks that may be needed when these events are occuring

The scripts are configured per process-type, and no suprises here, I've looked at it with respect to OC4J.

Here's how you configure it in an opmn.xml file:
  <process-type id="home" module-id="OC4J" status="enabled">
<module-data>
<category id="start-parameters">
<data id="java-options" value="-Xrs ..."/>
</category>
<category id="stop-parameters">
<data id="java-options" value="..."/>
</category>
</module-data>
<event-scripts>
<pre-start path="c:\\temp\\pre-start.bat"/>
<pre-stop path="c:\\temp\\pre-stop.bat"/>
</event-scripts>
<start timeout="600" retry="2"/>
<stop timeout="120"/>
<restart timeout="720" retry="2"/>
<port id="default-web-site" range="80-100" protocol="http"/>
<port id="rmi" range="12401-12500"/>
<port id="rmis" range="12701-12800"/>
<port id="jms" range="12601-12700"/>
<process-set id="default_group" numprocs="1"/>
</process-type>
The scripts are passed a set of arguments that provide information about the current environment such as the timestamp, the OC4J instance name and group, etc.

This is covered in more detail in Chapter 3 of the OPMN Administrators Guide.




2 comments:

Anonymous said...

Hi,

Is there a possibility that we can pass command line parameters in the path (pre-start). Or how do the called script gets the instance name when opmn invokes the script while starting an instance.

Thanks
CvaG

Buttso said...

A set of parameters are passed into the script -- see here for an example:
http://download-west.oracle.com/docs/cd/B31017_01/core.1013/b28944/appendix.htm#i1012494