If you need to find the list of ClearCase triggers installed in a single VOB, then run this command. You can also use this same command to find the location of each trigger's scripts and the configuration of each trigger too.
cleartool lstype -long -kind trtype -invob VOB_NAME
For instance, here is an example of this command and the command's output. This command may take a long time to execute, especially if you have a large VOB or if there are a lot of triggers installed in the VOB.
$ cleartool lstype -long -kind trtype -invob /vob/test
trigger type "checkin_permission_trigger"
14-Apr-99.14:22:22 by root (root@machine_name)
owner: root
group: group
all element trigger
pre-operation checkin
action: -exec \\windows_machine\path\script.bat || /path/script.pl
trigger type "stop_rmelem_trigger"
24-Jun-04.13:03:03 by root (root@machine_name)
owner: root
group: group
all element trigger
pre-operation rmelem
action: -execunix /usr/local/bin/perl /path/script2.pl
action: -execwin \\windows_machine\path\perl.exe \\windows_machine\path\script2.pl
Showing posts with label Clearcase triggers. Show all posts
Showing posts with label Clearcase triggers. Show all posts
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".
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:
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:
If you have any other ClearCase questions, please do not hesitate to contact me for free advice.
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 |
|---|
If you have any other ClearCase questions, please do not hesitate to contact me for free advice.
Subscribe to:
Posts (Atom)