Triggering before or after commands
Triggers of type command
allow you to configure
Helix Server
to run a trigger before or after a given command executes. You
might want to execute a script.
Before a command runs | After a command runs |
---|---|
|
connect its action with that of another tool or process, such as:
|
If you are Using Helix Core Server for Distributed Versioning, consider Triggering on pushes and fetches.
The following table describes the fields of the command
trigger.
Field | Meaning |
---|---|
|
The name of the command trigger. |
|
The command to execute is specified in the
|
|
The The
For the grammar of regular expressions, see p4 help grep. Examples of possible values:
To match a command name that is a substring of
another valid command, use the end-of-line
meta-character to terminate matching. For example, use
You cannot create a |
|
The trigger for Helix Server
to run when the condition implied by Specify the command in a way that allows Helix Server
to locate and run the command. The 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
|
Example command trigger
You might want a pre-user-sync trigger to run before a user's request to sync (p4 sync) is executed.
An example of a trigger table entry, check-sync command pre-user-sync "check-sync.pl %serverservices%", is shown below in a comment:
#!/usr/bin/perl
# Example pre-user-sync command trigger
# Trigger table entry:
# check-sync command pre-user-sync "check-sync.pl %serverservices%"
$serverservices = $ARGV[0]; # from %serverservices% in trigger table
$allowed_to_sync_from = 'edge-server';
if ($serverservices eq $allowed_to_sync_from) {
exit 0;
} else {
print 'Sync must only be run from edge servers !';
exit 1;
}