Related Documentation
- ACX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- EX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- M Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- MX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- PTX Series
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- QFX Series
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- SRX Series
- Example: Refreshing a Script from an Alternate Source
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- T Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
Refreshing a Script from an Alternate Location
In addition to updating a script from the master source defined by the source statement, you also can update a script from an alternate location using the set refresh-from configuration mode command or the request system scripts refresh-from operational mode command. This is convenient when, for example, the master source cannot be accessed due to network issues or other problems.
The update operation occurs as soon as you issue either the set refresh-from configuration mode command or the request system scripts refresh-from operational mode command. When you issue the command, the switch, router, or security device immediately attempts to connect to the specified URL and retrieve a copy of the file. The copy overwrites the local script stored in the scripts directory on the device. If a copy of the source is not available at the remote URL, 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-from command does not add the refresh-from statement to the configuration. Thus the set refresh-from command behaves like an operational mode command by executing an operation, instead of adding a statement to the configuration.
If a device has dual Routing Engines and you want the script to be updated on both Routing Engines, you must issue the set refresh-from command on each Routing Engine separately. The commit synchronize command does not cause the refresh-from 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. In operational mode, you can use the request system scripts refresh-from command with the sync option to refresh the script on both Routing Engines.
To update a single script from an alternate source, issue the set refresh-from command under the hierarchy level where the script is configured, and specify the location of the remote file. The hierarchy location depends on the script type and filename as shown in the following examples:
- [edit system scripts commit file filename]user@R1# set refresh-from url
- [edit system scripts op file filename]user@R1# set refresh-from url
- [edit event-options event-script file filename]user@R1# set refresh-from url
To update all enabled scripts of a given script type from an alternate source, issue the set refresh-from command at the hierarchy level for that script type, and specify the URL of the remote repository that houses the scripts.
- [edit system scripts commit]user@R1# set refresh-from url
- [edit system scripts op]user@R1# set refresh-from url
- [edit event-options event-script]user@R1# set refresh-from url
In operational mode, to update a single script from an alternate source, issue the request system scripts refresh-from command, and specify the script type, filename, and remote URL.
- user@R1> request system scripts refresh-from (commit | event | op) file filename url url <sync>
Where
- filename—Name of the script.
- url—URL of the remote script or directory. Specify the source as a Hypertext Transfer Protocol (HTTP) URL, FTP URL, or secure copy (scp)-style remote file specification.
If you request to refresh a script that does not exist at the remote site, the device generates an error message. For example:
user@host> request system scripts refresh-from
op file nonexistent.slax url http://host1.juniper.net/nonexistent.slaxrefreshing 'nonexistent.slax' from 'http://host1.juniper.net/nonexistent.slax' fetch-secure: http://host1.juniper.net/nonexistent.slax: Not Found error: file-fetch failed error: communication error: rpc failed (file-fetch) error: error retrieving file http://host1.juniper.net/nonexistent.slax
When you issue the set refresh-from command, Junos
OS creates a folder in the /var/tmp directory, which is used for the file transfer. After the transfer
and refresh operations are complete, Junos OS deletes the temporary
folder.
Related Documentation
- ACX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- EX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- M Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- MX Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- PTX Series
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- QFX Series
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- SRX Series
- Example: Refreshing a Script from an Alternate Source
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)
- T Series
- Example: Refreshing a Script from an Alternate Source
- request system scripts refresh-from
- refresh-from (Commit Scripts)
- refresh-from (Op Scripts)
- refresh-from (Event Scripts)