Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Store and Use Imported Scripts and Script Functionality

Starting in Junos OS Release 11.1, Junos OS provides a dedicated directory for script libraries, where users can store scripts and script functionality that then can be imported into any commit, event, op, or SNMP script. Upon installation, Junos OS creates the /var/db/scripts/lib/ directory. Junos OS will not overwrite or erase any files in an existing lib/ directory upon installation or upgrade.

If you store scripts in and run them from flash memory, both the executed scripts and the imported scripts must be present on the flash drive. When you configure the load-scripts-from-flash statement at the [edit system scripts] hierarchy level, Junos OS creates the /config/scripts/lib/ directory. When you add or remove the load-scripts-from-flash statement in the configuration, you must manually move scripts and script libraries from the hard disk to the flash drive, or vice versa, as appropriate. They are not moved automatically.

Imported scripts must be stored in the /var/db/scripts/lib/ directory on the hard disk, or if the load-scripts-from-flash statement is configured, in the /config/db/scripts/lib/ directory on the flash drive. To import a script from the script library, include the <xsl:import> tag in the style sheet declaration of an XSLT script or the import statement in a SLAX script and specify the file location. The following sample code imports the /var/db/scripts/lib/test.xsl file:

XSLT Syntax

SLAX Syntax