Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Synchronize Scripts Between Routing Engines

This example shows how to configure a device with dual Routing Engines running Junos OS to synchronize all commit, event, lib, op, and SNMP scripts between Routing Engines every time you execute a commit synchronize operation.

Requirements

A routing, switching, or security device with dual Routing Engines running Junos OS Release 13.2 (15.1 for SNMP scripts) or later is required.

Overview

In this example, you configure a device with dual Routing Engines running Junos OS to synchronize all commit, event, lib, op, and SNMP scripts from the requesting Routing Engine to the other Routing Engine whenever you execute a commit synchronize command to commit and synchronize the configuration. When configured, the device synchronizes all scripts regardless of whether they are enabled in the configuration.

In this example, the load-scripts-from-flash statement is not configured on the requesting Routing Engine. Thus, the device synchronizes the scripts that are on the hard disk of the requesting Routing Engine to the hard disk of the responding Routing Engine.

Note:

On the hard disk, scripts are stored under the /var/db/scripts directory in the subdirectory appropriate to the script type. In flash memory, scripts are stored under the /config/scripts directory in the subdirectory appropriate to the script type. EX Series switches use the default directory /config/db/scripts.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following command, paste it in a text file, and then copy and paste the command into the CLI at the [edit] hierarchy level.

Configuring Script Synchronization for Commit Synchronize Operations

Step-by-Step Procedure

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.

Results

The resulting configuration is:

Verification

Confirm that the configuration is working properly and the synchronization is successful.

Verifying Script Synchronization

Purpose

Verify that the scripts present on the requesting Routing Engine are synchronized to the other Routing Engine.

In this example, the load-scripts-from-flash statement is not configured for the requesting Routing Engine. Therefore, the device synchronizes scripts from the /var/db/scripts directory on the requesting Routing Engine to the /var/db/scripts directory on the responding Routing Engine.

Action

Use the file list operational mode command to view the files in the /var/db/scripts directory on each Routing Engine.

  1. On the requesting Routing Engine, list the files under the /var/db/scripts/ directory.

  2. Log in to the responding Routing Engine, and verify that the files are synchronized.

Meaning

The scripts present on each Routing Engine are identical indicating that the device successfully synchronized the scripts from the requesting Routing Engine to the responding Routing Engine.

Troubleshooting

Troubleshooting Script Synchronization Failure

Problem

The device does not synchronize the scripts present on the requesting Routing Engine to the other Routing Engine.

Solution

Verify the following:

  • You configured the synchronize statement at the [edit system scripts] hierarchy level.

  • You are viewing the correct directories on each Routing Engine.

    If the load-scripts-from-flash statement is configured for the requesting Routing Engine, the device synchronizes scripts from flash memory on the requesting Routing Engine to flash memory on the responding Routing Engine.

  • You executed a commit synchronize command when committing the configuration.

    The device does not synchronize scripts for a commit operation, only for a commit synchronize operation.

  • The commit check and commit operations for the requesting Routing Engine are successful.

    If the commit check operation for the requesting Routing Engine fails, the process stops, and the scripts are not copied to the responding Routing Engine.