Triggering on failed-over

A failed-over trigger can only be fired when a standby server becomes the new master and first starts up during a successful p4 failover command.

Special variables:

  • %standbyserverid% expands to the serverID of the standby before failover
  • %standbyserverport% expands to the P4PORT of the standby before failover

To define a failed-over trigger, use the p4 triggers command to configure the triggers form with this syntax:

triggerName failed-over failed-over command

The following table describes the fields for a trigger definition:

Field Meaning
name

The name of the trigger, such as testFailover2

type

Must be failed-over

path

Must be failed-over

command

The trigger for Helix Server to run when the master restarts after a successful failover. Specify the command in a way that allows Helix Server to locate and run the command. The command is typically a call to a script. The command must be quoted. The command can take any arguments that your trigger can parse, including Helix Server trigger variables.

Note
  • Most of the usual trigger variables are not available for this trigger because this fires at server startup before any client connection

  • You can have zero, one, or more failed-over triggers. Each failed-over trigger is asynchronous and independent of the others, so if one trigger fails, its failure has no effect on the others.

  • See also Triggering on heartbeat (server responsiveness) and Triggering on failed-back.

Example

In the Triggers: field, your form might have something similar to this:

testFailover failed-over failed-over "perl '%serverroot%'/test.pl '%serverport%' '%serverid%' '%standbyserverid%' '%standbyserverport%'"
testFailover2 failed-over failed-over "perl '%serverroot%'/test.pl '%serverport%' '%serverid%' '%standbyserverid%' '%standbyserverport%'"
testTrigger3 failed-over failed-over "perl '%serverroot%'/test.pl '%serverport%' '%serverid%' '%standbyserverid%' '%standbyserverport%'"