Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Synchronize Scripts Between Routing Engines

Starting in Junos OS Release 13.2, you can manually synchronize commit, event, lib, op, and SNMP 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

You can configure a device running Junos OS to synchronize all commit, event, lib, op, and SNMP 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:

  1. Configure the synchronize statement at the [edit system scripts] hierarchy level.
  2. Commit and synchronize the configuration.

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, op, and SNMP 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:

  1. Make all necessary changes to the configuration.
  2. Issue the commit synchronize scripts command.

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 the 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, op, or snmp 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, op, and SNMP 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.

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.

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.