Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Enabling an Op Script and Defining a Script Alias

Operation (op) scripts are stored on a device’s hard drive in the /var/db/scripts/op directory or on the flash drive in the /config/scripts/op directory. Only users in the Junos OS super-user login class can access and edit files in these directories. For information about setting the storage location for scripts, see Storing Scripts in Flash Memory.

Note: If the device has dual Routing Engines and you want to enable an op script to execute on both Routing Engines, you must copy the script to the /var/db/scripts/op or /config/scripts/op directory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines.

You must enable an op script before it can be executed. Include the file filename statement at the [edit system scripts op] hierarchy level, specifying the name of an XSLT or SLAX file containing an op script. Only users who belong to the Junos super-user login class can enable op scripts.

[edit system scripts op]file filename;

The filename of an op script written in SLAX must include the .slax extension for the script to be enabled and executed. No particular filename extension is required for op scripts written in XSLT, but we strongly recommend that you append the .xsl extension. Whether or not you choose to include the .xsl extension on the file, the filename that you add at the [edit system scripts op] hierarchy level must exactly match the filename of the script in the directory. For example, if the XSLT script filename is script1.xsl, then you must include script1.xsl in the configuration hierarchy to enable the script; likewise, if the XSLT script filename is script1, then you must include script1 in the configuration hierarchy.

To determine which op scripts are currently enabled on the device, use the show command to display the files included at the [edit system scripts op] hierarchy level. To ensure that the enabled files are on the device, list the contents of the /var/run/scripts/op/ directory using the file list /var/run/scripts/op operational mode command.

Optionally, you can define an alias for an op script and then specify either the filename or the alias when you execute the script. To define the alias, include the command statement at the [edit system scripts op file filename] hierarchy level:

[edit system scripts op]
file filename {command filename-alias;}

Published: 2013-03-05

Published: 2013-03-05