Configuring and Refreshing from the Master Source 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 the following concepts:
Configuring the Master Source for a Script
To specify the location of the master source for a single script, configure the source statement and the URL of the master file. Including the 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.
The hierarchy location for the source statement depends on the script type and filename.
- [edit event-options event-script file filename]user@R1# set source url
Where
- filename—Name of the script.
- url—URL of the script’s master source file. Specify the source as a Hypertext Transfer Protocol (HTTP) URL, FTP URL, or secure copy (scp)-style remote file specification.
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 switch, router, or security 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 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.
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.
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. The commit synchronize command does not cause the refresh statement to update scripts on both Routing Engines. Alternatively, starting with Junos OS Release 13.2, 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.
- Where filename is the name of the script.[edit event-options event-script 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

