Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

ClearCase Support: Installing and Implementing ClearCase Triggers

A ClearCase Trigger is simply a script that runs whenever a ClearCase action is performed. Triggers are completely customizable by the ClearCase Admins (VOB owner). Triggers can run before (preop) or after (postop) a ClearCase action. By default, ClearCase does not have any triggers turned on.

For example, if we would want to implement a trigger that will prevent users from permanently deleting ClearCase elements from the VOB using the "cleartool rmelem" command, here is one possible solution.

First, this is how to install a UNIX trigger, called "rmelem_trigger", on the VOB called "/vob/test". The trigger is actually a Perl script at this location "/clearcase/".

cleartool mktrtype -nc -element –all -preop rmelem
-execunix "/usr/local/bin/perl /clearcase/"

In an environment with multiple types of operating systems, you may need to install a second trigger script. For example, here is the same installation command while running a different executable for Windows would be:

cleartool mktrtype -nc -element –all -preop rmelem
-execunix "/usr/local/bin/perl /clearcase/"
-execwin "\\\\network_machine\\shar_directory\\perl\\perl.exe


An example of the trigger script in Perl for UNIX would be:

If the script exits with a status of "0", then the ClearCase Trigger action (cleartool rmelem) is executed. If the script exits with a status of "1", then the ClearCase Trigger action is NOT executed. Of course, the Windows Perl script needs to be written too.

To un-install a ClearCase trigger, use this command:

cleartool rmtype -force trtype:rmelem_trigger@vob:/vob/test

by Phil for Humanity
on 03/10/2008

Related Articles
 » ClearCase Support: Finding ClearCase Triggers
 » ClearCase Support: Recursively Adding to Source Control
 » ClearCase Support: How to Find Checked Out Elements