Trigger-Commands
Used In: Trigger sections
Status: Mandatory
The Trigger-Commands
attribute enables substantial follow-up actions to be taken by a Trigger section following an Output-Trigger
call. The attribute allows the script author to execute a sequence of CLI commands for all template matches that pass the Trigger-Filter
criteria. Each command must appear on a new line. You can use Conditional processing with { } notation (similar to Action-Commands
in the Action-Commands: topic) in Trigger-Commands
as well.
Besides CLI commands, the Trigger-Commands
attribute accepts sleep directives, which pause script execution for a specified number of seconds.
sleep: <numberOfSeconds>
Example
Trigger-Commands:
config terminal
interface $ifName
spanning-tree portfast
exit
exit
SET: $updateMade = "yes"
Example
Trigger-Commands: { $priority eq "0" and $state ne "Ready" }
SET: $matchFound = "yes"
...
In both cases, the SET variables are newly declared in the script. It forms a basic IF-THEN loop, in this case where IF the device's priority value is "0" and the device's state is determined to not be READY, the new matchFound
variable is set to "yes" and further script directives designed to respond to the state will execute.
That SET variable also can be referenced anywhere else as needed in the script after declaration.
Note: This example is in a Trigger section. A Trigger-Command
is the only attribute type that can execute any type of looping or iterative processing in a CCS script. For more, see the Trigger-Commands: section of this Guide.