add event trigger

Description

Adds a trigger that is executed by the RMS when a specific event occurs in the replication domain. A trigger identifies a process or script that is executed by the RMS.

Syntax

add status trigger 
	[{connection | logical connection | route | queue | rep agent
		|partition} 
	component_name] for server_name
	status changes to state 
	[wait wait_interval]
	[continuous continuous_flag]
	execute command

Parameters

status

Type of trigger.

connection, logical connection, route, queue, rep agent, partition

Specifies the type of component to be monitored. Components are monitored objects within a server. Replication Server components are connections, logical connections, routes, queues, and partitions; Adaptive Server Enterprise components are RepAgent threads.

component_name

Specifies the name of the component to be monitored.

for server_name

Specifies the name of the server to be monitored. If the command is to add a trigger for a component, then the server is the owner of the component.

status changes to state

Specifies the state of the server or component to monitor. If state changes to the specified value, the trigger executes. The state value is dependent on the object type. See Appendix C, “RMS Server and Component States” for information about the state codes.

wait wait_interval

Specifies the number of seconds to wait before triggering the event. This allows the object time to recover. If you do not include the wait option, the event triggers immediately.

continuous continuous_flag

A Boolean flag that, if set to true, causes the RMS to execute the trigger’s script at every subsequent monitoring interval until the state changes. If you do not set this flag, the RMS executes the trigger script only once.

execute command

Specifies the command to be executed when the event is triggered. The command is operating-system-specific.

Examples

Example 1

Adds a trigger that executes the script email.sh when the status of the server named INVENTORY_RS is changed to “DOWN”:

add status trigger for INVENTORY_RS 
status changes to DOWN 
execute /sybase/RMS/scripts/email.sh

Example 2

Adds a trigger that executes the script email.sh after 120 seconds. Since the status of the connection “inventory_pds.pdb1” of server INVENTORY_RS is changed to “Suspended”, it will execute script at every subsequent monitoring interval until the state changes:

add status trigger connection inventory_pds.pdb1 for
    INVENTORY_RS
status changes to Suspended
wait 120
continuous true
execute /sybase/RMS/scripts/email.sh

Usage

See also

drop event trigger, get triggers