After you write an automation script, you must save it in one of two places, depending on the type of script you have written. Save op scripts in the /var/db/scripts/op directory and event scripts in the /var/db/scripts/event directory on the routing platform. Automation scripts in the /var/db/scripts/(op | event) directories are ignored if they are not enabled. Only users in the superuser JUNOS login class can access and edit files in the /var/db/scripts/(op | event) directory.
If a platform has dual Routing Engines and you want the script to take effect on both Routing Engines, you must copy the script to the /var/db/scripts/op or the /var/db/scripts/event directory on each Routing Engine. The commit synchronize command does not automatically copy the scripts from one Routing Engine directory into the other Routing Engine directory.
To enable an automation script, include the file statement at the [edit system scripts op] (for op scripts) or the [edit event-options events-script] (for event scripts) hierarchy level, specifying the name of an Extensible Stylesheet Language Transformations (XSLT) or Stylesheet Language Alternative Syntax (SLAX) file containing an automation script. When you enable a SLAX script, you must include the .slax extension in the filename. If you do not, the configuration commits, but the script cannot be executed. When you enable an XSLT script, the .xsl extension is optional but strongly recommended.
For op scripts, the optional command statement allows you to specify an alias for the filename of the script. Thus, you can run the script by invoking either the filename or the filename alias.
- [edit system scripts op]
-
file filename {
-
command filename-alias;
- }
- [edit event-options event-script]
- file filename;