Helix Core Server Administrator Guide: Fundamentals (2019.2)

Triggering on journal rotation

To configure Helix server to run trigger scripts when journals are rotated, use the journal-rotate and journal-rotate-lock type triggers. Journal-rotate triggers are executed after the journal is rotated on a running server, but only if journals are rotated with the p4 admin journal or p4 admin checkpoint commands. Journal rotate triggers will not execute when journals are rotated with the p4d -jc or p4d --jj commands.

Journal-rotate triggers allow you to run maintenance routines on servers after the journal has been rotated, either while the database tables are still locked or after the locks have been released. These triggers are intended to be used on replicas or edge servers where journal rotation is triggered by journal records. The server must be running for these triggers to be invoked.

The following table describes the fields of a journal-rotate trigger:

Field Meaning

type

  • journal-rotate-lock: Execute the trigger after the journal is rotated but while the database files are still locked.
  • journal-rotate: Execute the trigger after the journal is rotated and data base file locks are released.

path

The server on which the triggers should be run. One of the following:

  • any
  • serverid- run on the specified server

command

The trigger for Helix server to run when the server matching path is found for the trigger type. Specify the command in a way that allows Helix server account to locate and run the command. The command (typically a call to a script) must be quoted, and can take as arguments anything that your command is capable of parsing, including any applicable Helix server trigger variables.

Journal-rotate triggers can process two variables: %journal% and %checkpoint%. These specify the names of the rotated journal and the new checkpoint if a checkpoint was taken. If no checkpoint was taken, %checkpoint% is an empty string.

When your trigger script is stored in the depot, its path must be specified in depot syntax, delimited by percent characters. For example, if your script is stored in the depot as //depot/scripts/myScript.pl, the corresponding value for the command field might be "/usr/bin/perl %//depot/scripts/myScript.pl%". See Storing triggers in the depot for more information.