Execute 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.
user@host> op (filename | filename-alias | url url)
For more information about executing op scripts from a remote
site using op url
, see Execute an Op Script from a Remote Site.
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.
[edit system login] class class-name { login-script filename; }
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 Enable an Op Script and Define a Script Alias).
[edit system login] class super-user { login-script super-user-login.slax; }