Implementing Op Scripts
To use op scripts on a router or switch, follow these steps:
- Write the op script.
For information on writing op scripts, see . For examples, see .
- Copy the script to the
/var/db/scripts/opdirectory on the hard drive or the/config/scripts/opdirectory on the flash drive; for information about setting the storage location for scripts, see Storing Op Scripts in Flash Memory. Only users who belong to the JUNOS super-user login class can access and edit files in these directories.
Note: If the router or switch has dual Routing Engines and you want to enable the op script to execute on both Routing Engines, you must copy the script to the
/var/db/scripts/opor/config/scripts/opdirectory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines. - Enable the script by including the file filename statement at the [edit system scripts op] hierarchy level. For instructions, see Enabling an Op Script and Defining a Script Alias.
- Issue the commit command.
After the commit operation completes, the op script can be executed on the router or switch. See Executing an Op Script.

