Configure and Use a Master Source Location for a Script
You can store a master copy of each script in a central repository. This eases file management because you can make changes to the master script in one place and then update the copy on each device where the script is currently enabled. This section discusses how to configure the master source location for a script and how to refresh the local copy of the script.
Configuring the Master Source for a Script
To specify the source location for the master copy of an individual script:
source
statement in the configuration does not
affect the local copy of the script until you issue the set refresh
command. At that point, the device retrieves the master copy from the specified URL
and overwrites the local copy.Configuring the Routing Instance Used to Update a Script from the Master Source
Before Junos OS Release 18.1R1, scripts could be updated from
a master source using the default management interface. However, starting
in Junos OS Release 17.3R1, you are able to confine the management
interface in a nondefault virtual routing and forwarding (VRF) instance
so that management traffic no longer has to share a routing table
with other control or protocol traffic. Starting in Junos OS Release
18.1R1, you can specify a routing instance to use to refresh or download
a commit, event, JET, op, or SNMP script from a master source. This
routing instance can be either the nondefault management instance mgmt_junos
or some other routing instance.
You must configure the routing instance you specify to update
scripts through at the [edit system routing-instances]
hierarchy
level.
To use mgmt_junos
to update scripts from a master
source:
To update scripts from a master source using a configured
management interface, you can configure only mgmt_junos
for the routing-instance-name
. To
use a non-management interface, you can configure anything for the routing-instance-name
.
See Also
Updating a Script from the Master Source
If you configure a master source for one or more scripts on
a device, you can refresh the scripts on that device using the set refresh
configuration mode command. You can update
a single script or all scripts of a given script type that have a
master source location configured.
The update operation occurs as soon as you issue the set refresh
command. When
you issue the set refresh
command, the device immediately
attempts to connect to the specified URL and retrieve a copy of the master file.
The master copy overwrites the local script stored in the scripts directory on
the device. If the load-scripts-from-flash
statement is
configured, the device updates the script on the flash drive instead of the
script on the hard disk. If a master source is not defined for a script, that
script is not updated and a warning is issued. For commit scripts, the updated
commit script is executed when you next issue the
commit
command. If the script configuration includes the
routing-instance
statement, then Junos OS updates the
script using that routing instance.
Issuing the set refresh
command does not
add the refresh
statement to the configuration. Thus the
command behaves like an operational mode command by executing an operation,
instead of adding a statement to the configuration.
The set refresh
command is unique in the Junos
OS CLI in that it behaves like an operational mode command and yet
it can be executed from within configuration mode. All other Junos
OS CLI operational mode commands can only be executed from command
mode. The functionality is provided in this manner as a convenience
to users developing commit scripts.
If the device has dual Routing Engines and you want to update a script on both Routing Engines,
you must issue the set refresh
command on each Routing Engine
separately. Alternatively, you can refresh the scripts on the requesting Routing
Engine and then use either the request system scripts
synchronize
operational mode command to synchronize scripts to the
other Routing Engine or the commit synchronize scripts
configuration mode command to synchronize all scripts to the other Routing
Engine when you commit and synchronize the configuration.
To update a single script from its master source, issue the set refresh
command at the hierarchy level where the script
is configured. The hierarchy location depends on the script type and
filename as shown in the following examples. The source
statement specifying the master source location must already be
configured.
[edit event-options event-script file filename] user@R1# set refresh
[edit system extensions extension-service application file filename] user@R1# set refresh
[edit system scripts commit file filename] user@R1# set refresh
[edit system scripts op file filename] user@R1# set refresh
[edit system scripts snmp file filename] user@R1# set refresh
To update all enabled scripts of a given script type from their
master source files, issue the set refresh
command
at the hierarchy level for that script type.
[edit event-options event-script] user@R1# set refresh
[edit system extensions extension-service application] user@R1# set refresh
[edit system scripts commit] user@R1# set refresh
[edit system scripts op] user@R1# set refresh
[edit system scripts snmp] user@R1# set refresh
See Also
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.