Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, QFX, T Series
- Example: Configuring Script Synchronization Between Routing Engines
- synchronize (Scripts)
- request system scripts synchronize
- request system scripts refresh-from
- ACX, EX, J, M, MX, PTX, QFX, T Series
- commit
Synchronizing Scripts Between Routing Engines
Understanding Script Synchronization Between Routing Engines
Starting with Junos OS Release 13.2, you can manually synchronize commit, event, lib, and op scripts between Routing Engines on a device running Junos OS or configure the device to automatically synchronize scripts between Routing Engines when you commit and synchronize the configuration. When invoked, the device synchronizes the scripts from the Routing Engine on which you execute the request (the requesting Routing Engine) to the other Routing Engine (the responding Routing Engine).
In operational mode, you can manually synchronize scripts from the requesting Routing Engine to the responding Routing Engine using the request system scripts synchronize command. The command permits you to customize the scope of the synchronization. You can synchronize a single script, all scripts of a specific type, or all scripts on the device. You also have the option to synchronize scripts based on filename or on the timestamp of the file.
In configuration mode, you have the option to synchronize all scripts when you commit and synchronize the configuration. To synchronize scripts on a per-commit basis, use the commit synchronize scripts command when you commit and synchronize the configuration. Alternatively, you can configure the device to automatically synchronize scripts from the requesting Routing Engine to the responding Routing Engine every time you issue a commit synchronize command. To ensure that scripts are copied from the requesting Routing Engine to the responding Routing Engine during a commit synchronize operation, configure the synchronize statement at the [edit system scripts] hierarchy level.
When you synchronize the configuration and scripts, the device:
- Performs a commit check on the requesting Routing Engine
- Synchronizes scripts to the responding Routing Engine
- Synchronizes the configuration to the responding Routing Engine
- Performs a commit check on the responding Routing Engine
- Commits the configuration on the responding Routing Engine
- Commits the configuration on the requesting Routing Engine
This process ensures that any commit scripts that are required for a successful commit operation are present on the responding Routing Engine before committing the configuration. If the commit check operation fails for the requesting Routing Engine, the process stops, and the scripts are not copied to the responding Routing Engine. If the commit check or commit operation fails for the responding Routing Engine, the scripts are still synchronized since the synchronization occurs prior to the commit check operation on the responding Routing Engine.
When synchronizing scripts, the device running Junos OS determines the script source and destination directories based on whether the load-scripts-from-flash statement is present in the configuration for each Routing Engine. If the load-scripts-from-flash statement is configured for the requesting Routing Engine, the device synchronizes the scripts that are in flash memory. Otherwise, the device synchronizes the scripts that are on the hard disk. If the load-scripts-from-flash statement is present in the final configuration for the responding Routing Engine, the scripts are synchronized to flash memory. Otherwise, the scripts are synchronized to the hard disk. The device synchronizes a script regardless of whether it is enabled in the configuration or has been updated since the last synchronization.
The request system scripts refresh-from operational mode command permits you to manually refresh a single script from a remote URL. Starting with Junos OS Release 13.2, you can synchronize the updated script to the other Routing Engine by including the sync option when you execute the command. When you execute the command, if the load-scripts-from-flash statement is configured on the Routing Engine, the script is refreshed in flash memory. Otherwise, the script is refreshed on the hard disk.
Script Synchronization Between Routing Engines
Starting with Junos OS Release 13.2, you can manually synchronize commit, event, lib, and op scripts between Routing Engines on a device running Junos OS or configure the device to automatically synchronize scripts between Routing Engines when you commit and synchronize the configuration.
If the load-scripts-from-flash statement is configured for the requesting Routing Engine, the device synchronizes the scripts that are in flash memory. Otherwise, the device synchronizes the scripts that are on the hard disk. If the load-scripts-from-flash statement is present in the final configuration for the responding Routing Engine, the scripts are synchronized to flash memory. Otherwise, the scripts are synchronized to the hard disk. The device synchronizes a script regardless of whether it is enabled in the configuration or has been updated since the last synchronization.
The following sections outline the different methods for synchronizing scripts:
- Configuring Script Synchronization Between Routing Engines for Commit Synchronize Operations
- Synchronizing Scripts Between Routing Engines on a Per-Commit Basis
- Synchronizing Scripts Between Routing Engines from Operational Mode
- Synchronizing a Script Between Routing Engines After a Refresh
Configuring Script Synchronization Between Routing Engines for Commit Synchronize Operations
You can configure a device running Junos OS to synchronize all commit, event, lib, and op scripts from the requesting Routing Engine to the other Routing Engine every time you issue the commit synchronize command to commit and synchronize the configuration.
To automatically synchronize scripts between Routing Engines during a commit synchronize operation:
Configure the synchronize statement at the [edit system scripts] hierarchy level.
[edit system scripts]user@host# set synchronizeCommit and synchronize the configuration.
[edit system scripts]user@host# commit synchronize
When you issue the first and subsequent commit synchronize commands, the device performs a commit check on the requesting Routing Engine, synchronizes all scripts to the other Routing Engine, synchronizes, performs a commit check, and commits the configuration on the responding Routing Engine, and finally commits the configuration on the requesting Routing Engine. If the commit check operation fails for the requesting Routing Engine, the process stops, and the scripts are not copied to the responding Routing Engine. If the commit check or commit operation fails for the responding Routing Engine, the scripts are still synchronized since the synchronization occurs prior to the commit check operation on the responding Routing Engine.
Configuring the synchronize statement causes the device to synchronize all scripts even if they have not been updated since the last synchronization. If the device has a large number of scripts that are infrequently updated, it might be more suitable to synchronize scripts either manually using the request system scripts synchronize operational mode command or on a per-commit basis using the commit synchronize scripts command.
Synchronizing Scripts Between Routing Engines on a Per-Commit Basis
You can synchronize all commit, event, lib, and op scripts from the requesting Routing Engine to the other Routing Engine on a device running Junos OS on a per-commit basis using the commit synchronize scripts command when you commit and synchronize the configuration. This is an alternative to configuring the device to synchronize scripts every time you execute a commit synchronize operation.
To synchronize scripts between Routing Engines on a per-commit basis:
- Make all necessary changes to the configuration.
Issue the commit synchronize scripts command.
[edit]user@host# commit synchronize scripts
When you issue the commit synchronize scripts command, the device performs a commit check on the requesting Routing Engine, synchronizes all scripts to the other Routing Engine, synchronizes, performs a commit check, and commits the configuration on the responding Routing Engine, and finally commits the configuration on the requesting Routing Engine. If the commit check operation fails for the requesting Routing Engine, the process stops, and the scripts are not copied to the responding Routing Engine. If the commit check or commit operation fails for the responding Routing Engine, the scripts are still synchronized since the synchronization occurs prior to the commit check operation on the responding Routing Engine.
Synchronizing Scripts Between Routing Engines from Operational Mode
You can manually synchronize scripts from the requesting Routing Engine to the other Routing Engine on a device running Junos OS by using the request system scripts synchronize operational mode command. You can synchronize a single script, all scripts of a specific type, or all scripts on the device. You also have the option to synchronize scripts based on filename or on the timestamp of the file.
To manually synchronize scripts between Routing Engines, issue the request system scripts synchronize command with the desired options.
Specify all to synchronize all scripts present on the requesting Routing Engine to the responding Routing Engine. Specify commit, event, lib, or op to synchronize all scripts of the given type to the other Routing Engine. Include the file option or the newer-than option to narrow the scope to only synchronize scripts with the specified filename or date criteria. The format for the newer-than argument is YYYY-MM-DD.HH:MM:SS.
For example, the following command synchronizes all commit, event, lib, and op scripts that have a timestamp newer than 2012-05-15:
The following command synchronizes a single op script
with the filename vpn-info.slax
.
A synchronize operation might fail if, for example, you request to synchronize a script that does not exist or if the responding Routing Engine cannot handle the request at that time, because it is performing other CPU-intensive operations. If the synchronize operation fails, the device generates an error message.
The following command requests to synchronize a single event script, but the script does not exist in the event scripts directory, so the device issues an error.
error: Invalid directory: No such file or directory warning: No script will be pushed to other RE
The following command requests to synchronize a single event script, but the responding Routing Engine does not have the resources to perform the synchronization, so the device issues an error. The device also logs a UI_SCRIPTS_COPY_FAILED error in the system log file with a severity level of error.
error: Unable to copy scripts to re: re1
Synchronizing a Script Between Routing Engines After a Refresh
You can manually refresh a single script from a remote URL and synchronize the updated script to the other Routing Engine on a device running Junos OS by using the request system scripts refresh-from operational mode command with the sync option.
To manually refresh a single script from a remote source and then synchronize the script to the other Routing Engine, issue the request system scripts refresh-from command with the sync option, and specify the script type, filename, and remote URL. Specify the URL as an HTTP URL, FTP URL, or secure copy (scp)-style remote file specification.
The system uses the script type to determine the directory on the device where the script resides. If the load-scripts-from-flash statement is present in the configuration for the Routing Engine, the system refreshes the script in flash memory. Otherwise, the system refreshes the script on the hard disk.
Related Documentation
- ACX, EX, M, MX, PTX, QFX, T Series
- Example: Configuring Script Synchronization Between Routing Engines
- synchronize (Scripts)
- request system scripts synchronize
- request system scripts refresh-from
- ACX, EX, J, M, MX, PTX, QFX, T Series
- commit
Published: 2013-07-26
Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, QFX, T Series
- Example: Configuring Script Synchronization Between Routing Engines
- synchronize (Scripts)
- request system scripts synchronize
- request system scripts refresh-from
- ACX, EX, J, M, MX, PTX, QFX, T Series
- commit