Enabling a Trigger

Depending on its type, an AccuRev trigger is enabled in one of these ways:

  • Executing an accurev mktrig command, specifying the location of the script. AccuRev simply records the location you specify in the repository; it doesn"t make a copy of the script. Make sure that no one moves it!

  • Placing the executable script file in the location prescribed for that type of trigger.

For details, consult the appropriate sections below.

pre-create-trig, pre-keep-trig, pre-promote-trig, server-post-promote-trig

Use the mktrig command to enable use of the script in a particular depot. For example:

accurev mktrig -p WidgetDepot pre-keep-trig /usr/ac_scripts/addheader

The -p option isn"t necessary if your current directory is in a workspace associated with that depot. When the trigger fires, AccuRev will search for the script at the specified pathname (in the example above, /usr/ac_scripts/addheader).

AccuRev recommends specifying an absolute pathname for the server-post-promote-trig only. Otherwise, when the trigger fires, AccuRev will use the search path of the AccuRev Server's user identity to find the specified script file.

You should not specify absolute pathnames for the pre-create-trig, pre-keep-trig, or pre-promote-trig. In this case, AccuRev uses the user's search path to find the specified script file.

Back to top

server_admin_trig, server_master_trig

Place an executable file in subdirectory triggers of the site_slice directory:

  • UNIX/Linux: the file must be named server_admin_trig or server_admin_trig.pl (or server_master_trig or server_master_trig.pl)

  • Windows: the file must be named server_admin_trig.bat (or server_master_trig.bat)


C:\Program Files\AccuRev\storage\site_slice\triggers\server_admin_trig.bat

Back to top


Place an executable file in subdirectory triggers of the slice directory of one or more depots (accurev show slices displays slice directory locations):

  • UNIX/Linux: the file must be named server_preop_trig or server_preop_trig.pl

  • Windows: the file must be named server_preop_trig.bat



Back to top


Place an executable file in the AccuRev executables (bin) directory on the AccuRev Server machine:

  • UNIX/Linux: the file must be named server_dispatch_post or server_dispatch_post.pl

  • Windows: the file must be named server_dispatch_post.bat

Note: for compatibility with previous AccuRev releases, the script can also be named dispatch_email, with the appropriate suffix.


C:\Program Files\AccuRev\bin\server_dispatch_post.bat

Back to top

Notes on Triggers in Multiple-Depot Environments

If you have multiple depots, you may wonder whether to use a single trigger for all depots, or separate triggers for each depot. There is no single correct approach, as it depends on what you are attempting to accomplish, and what level of granularity you need to achieve. For example, the basic administrative features of the server_admin_trig trigger might apply to all depots. If you configure some of its other features, you might need to configure it for specific depots. On the other hand, it is likely that you would want to implement separate server_preop_trig triggers for each depot.

It all depends on what you are attempting to accomplish. Carefully plan out what features you need and determine whether or not they will be affected by the requirements of different depots. Then implement as necessary.

Notes on Triggers in Multiple-Platform Environments

If you have a mixed environment where you have both Windows and UNIX/Linux clients accessing the same depot, you can set up triggers that will operate for both.

  • Create trigger scripts that have the exact same name for both platforms, but ensure that the Windows version has the appropriate extension (e.g., check_for_comments.bat), and that the UNIX/Linux script has no extension (check_for_comments).

  • Test them and ensure that the scripts run correctly on their respective platforms.

  • Place both versions of the script in the same directory. (You can place the Windows and UNIX/Linux scripts in separate directories if you need to, but we recommend keeping them together for simplicity and ease of maintenance.) This directory needs to be visible to all clients—it needs to be exported or shared from the server, and mapped or mounted on the clients.

  • Adjust the PATH on your clients to point to the proper directory for their platform. For example, the PATH setting "S:\triggers" on Windows clients might be "/mnt1/ac/triggers" on UNIX/Linux machines.

  • Execute the mktrig command, specifying the script name without a suffix, and without a qualifying path:

accurev mktrig -p WidgetDepot pre-keep-trig check_for_comments

When called by a Windows client, the trigger script with an extension will get executed. When called by a UNIX/Linux client, the trigger script without the extension will get executed.

Remember to revise all versions of a script when you revise any one of them.

Back to top