11. Using Streams to Enforce Process : Implementing the server_master_trig Trigger

Implementing the server_master_trig Trigger
This section describes how to implement the server_master_trig trigger -- what changes to make to it and how to enable it -- to support gated streams. Note that this section describes aspects of trigger implementation that are unique to the server_master_trig trigger. See Chapter 10 AccuRev Triggers for more information on AccuRev triggers and how to use them.
Step 1: Create a Non-expiring Session
The first thing to do in order to implement the server_master_trig trigger is to create a non-expiring session on the AccuRev Server by logging in to the AccuRev Server using accurev login -n <username> <password>. This is typically the admin user. Make a note of this user’s username as you will need include it in the server_master_trig trigger when you edit it.
This is a one-time procedure, and one which you might have already performed if you are already using server-side triggers in your AccuRev installation. See Trigger Script Execution and User Identities for more information.
Step 2: Edit the server_master_trig Trigger
All sample triggers are installed to the examples directory where you installed AccuRev, c:\Program Files (x86)\AccuRev\examples\, for example. In order to edit the server_master_trig trigger:
1.
Make a copy of the server_master_trig trigger. Do not edit the server_master_trigger.pl file in the examples directory.
2.
# Unix Example
# $::AccuRev = "/usr/accurev/bin/accurev";
#
# Windows Example
$::AccuRev = "C:\\progra~1\\accurev\\bin\\accurev.exe";
You use this section to configure the path of the AccuRev executable. Note that there are separate sections for UNIX and Windows users. The Windows section is uncommented by default.
a.
b.
Modify the path shown for $::AccuRev= as needed.
3.
# Unix Example
# $ENV{'HOME'} = "/home/replace_with_username";
#
# Windows Example
$ENV{'HOMEDRIVE'} = "c:";
$ENV{'HOMEPATH'} = "\\Users\\replace_with_username";
You use this section to configure the path to the home directory for the AccuRev user under which this trigger script will be run. Note that there are separate sections for UNIX and Windows users. The Windows section is uncommented by default.
a.
b.
Replace replace_with_username with the <username> you specified using the login -n command in the preceding section, Step 1: Create a Non-expiring Session.
4.
####################################################### CUSTOMIZE ME
##### START: CUSTOM EXTERNAL ACTION #####
You use this section of the server_master_trig trigger script to specify what it is you want the trigger to do. For example, you can use Perl to:
5.
When you have finished modifying your copy of server_master_trig.pl, save your changes.
Step 3: Put server_master_trig.pl on the Server
Once you have saved your changes to server_master_trig.pl:
1.
Create the a \storage\site_slice\triggers directory where you installed AccuRev if one does not already exist.
2.
Copy the modified server_master_trig.pl to storage\site_slice\triggers.
Step 4: Windows Only: Create a Batch File for server_master_trig.pl
Once you have saved your changes to server_master_trig.pl, you need to create batch file if your AccuRev server is running on Windows. It is the batch file that AccuRev executes when elements are promoted into the gated stream.
1.
Navigate to the \storage\site_slice\triggers directory where you copied the server_master_trig trigger.
2.
pl2bat server_master_trig.pl
This creates a batch file with the same name as the trigger (server_master_trig.bat).

Micro Focus