Implementing Op Scripts

To use op scripts on a router or switch, follow these steps:

  1. Write the op script.

    For information about writing op scripts, see Writing Op Scripts. For examples, see Op Script Examples.

  2. Copy the script to the /var/db/scripts/op directory on the hard drive or the /config/scripts/op directory 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/op or /config/scripts/op directory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines.

  3. 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.
  4. 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.