Phil for Humanity

A Guide for the Survival of Humankind, and Improving the World, Society, and Yourself!


Popular Articles
  • Reasons For and Against
    Human Cloning
  • Globalization of the USA
  • The Pros and Cons of
    Capital Punishment
  • World's Stupidest Game

  • Latest Articles

  • How to Help Humanity
  • Why Economists Miss the Mark
  • Daylight Saving Time
  • Natural Log Proof
  • Subscribe to RSS Feed

  • Main Menu

  • HOME
  • SAVE HUMANITY (42)
  • HELP THE WORLD (96)
  • IMPROVE GOVERNMENTS (87)
  • PERSONAL DEVELOPMENT (238)
  • COMPUTER HELP (125)
  • ARCHIVE (all articles)
  • SEARCH THIS SITE
  • CONTACT US
  • DISCLAIMER
  • PLEASE HELP: DONATE

  • 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/rmelem_trigger/rmelem_trigger.pl".

    cleartool mktrtype -nc -element –all -preop rmelem
    -execunix "/usr/local/bin/perl /clearcase/rmelem_trigger/rmelem_trigger.pl"
    rmelem_trigger@/vob/test

    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/rmelem_trigger/rmelem_trigger.pl"
    -execwin "\\\\network_machine_name\\shar_directory\\perl\\perl.exe
    \\\\network_machine_name\\shar_directory\\rmelem_trigger\\rmelem_trigger.pl"

    rmelem_trigger@/vob/test

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

    #!/usr/local/bin/perl
    my $WHOAMI = `/bin/whoami`;
    chomp $WHOAMI;
    if ($WHOAMI eq "root")
    {
       exit 0;
    }
    else
    {
       print “\n\nERROR: You are not allowed to remove elements from the VOB!\n\n\n”;
       exit 1;
    }

    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 B.

    Related Articles
     » ClearCase Support: Finding ClearCase Triggers
     » ClearCase Support: How to Find Checked Out Elements
     » ClearCase Support: How to Make a ClearCase Branch







    Copyright © 2006-2009, Phil for Humanity. All Rights Reserved.