Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Executing an Op Script on the Local Device

 

Unlike commit scripts, operation (op) scripts do not execute during a commit operation. When you issue the commit command, op scripts configured at the [edit system scripts op] hierarchy level are placed into system memory and enabled for execution. After the commit operation completes, you can execute an op script from the CLI by issuing the op command in operational mode. You also can configure the device to execute an op script automatically when a member of a specific Junos OS login class logs in to the CLI.

Executing an Op Script by Issuing the op Command

To execute an op script from the CLI, issue the op command, and specify a script filename, a script alias as defined by the command statement at the [edit system scripts op file filename] hierarchy level, or a URL.

For more information about executing op scripts from a remote site using op url, see Executing an Op Script from a Remote Site.

Note

In order to execute Python op scripts from a remote site, you must configure the allow-url-for-python statement at the [edit system scripts op] hierarchy level.

Executing an Op Script at Login

You can configure an op script to execute automatically when any user belonging to a designated Junos OS login class logs in to the CLI. To associate an op script with a login class, include the login-script filename statement at the [edit system login class class-name] hierarchy level

The following example configures the super-user-login.slax op script to execute when any user who belongs to the super-user class logs in to the CLI (provided that the script has been enabled as discussed in Enabling an Op Script and Defining a Script Alias).