Sun Enterprise 10000 SSP 3.5 User Guide

Performing Command Synchronization

Command synchronization recovers user-defined commands that are interrupted by a failover and automatically reruns those commands on the new main SSP after a failover. Command synchronization does the following:

If you want user commands to be automatically recovered after a failover, you must prepare these user commands for synchronization as explained in the following sections.

Preparing User Commands for Automatic Restart

The runcmdsync(1M) command prepares a user command for automatic restart. runcmdsync adds the user command to the command synchronization list, which identifies the commands to be rerun after a failover.

To Prepare a User Command for Restart
  1. As user ssp on the main SSP, type:


    ssp% runcmdsync script_name [parameters] 
    

    where:

    script_name is the name of the user command to be restarted.

    parameters are the options associated with the specified command.

    The specified command will be rerun automatically on the new main SSP after a failover.

Preparing User Scripts for Automatic Recovery

If you want to resume processing of a user script from a certain marked point (location) within the script, you must include the following synchronization commands in the user script:

Each script must contain the initcmdsync and cancelcmdsync commands to initialize the script for synchronization and then remove the command from the command synchronization list respectively. For details on the synchronization commands, see the cmdsync(1M) man page.


Note -

These synchronization commands are intended for use by experienced programmers. You can use the runcmdsync(1M) command instead of the synchronization commands described in this section to prepare a script for recovery. However, the runcmdsync(1M) command will prepare the script so that it is rerun from the beginning and not from specified marker points.


The following procedures describe how to use these synchronization commands.


Note -

After an SSP failover or in a single SSP configuration, SSP failover is disabled. When failover is disabled, scripts that contain synchronization commands will generate error messages to the platform log file and return non-zero exit codes. These error messages can be ignored.


To Create a Command Synchronization Descriptor
  1. In your user script, type the following to create a command synchronization descriptor that identifies your script:


    initcmdsync script_name [parameters]

    where:

    script_name is the name of the script.

    parameters are the options associated with the specified script.

    The output returned from the initcmdsync command serves as the command synchronization descriptor.

To Specify a Command Synchronization Marker Point
  1. In your user script, type the following to mark an execution point from which processing can be resumed:


    savecmdsync -M identifier cmdsync_descriptor 
    

    where:

    identifier is a positive integer that marks an execution point from which the script can be restarted.

    cmdsync_descriptor is the command synchronization descriptor output by the initcmdsync command.

To Remove a Command Synchronization Descriptor
  1. In your user script, type the following after the script termination sequence:


    cancelcmdsync cmdsync_descriptor
    

    where cmdsync_descriptor is the command synchronization descriptor output by the initcmdsync command. The specified descriptor is removed from the command synchronization list so that the user script is not run on the new main SSP after a failover.

Obtaining Command Synchronization Information

Use the showcmdsync(1M) command on the main SSP to review the command synchronization list that identifies the user commands to be restarted on the new main SSP after an automatic failover.

The following is an example command synchronization list output by the showcmdsync (1M) command:


ssp% showcmdsync 
DESCRIPTOR      IDENTIFIER   CMD
         0              -1   c1 c2 a2

For further details, see the showcmdsync(1M) man page.

Example Script with Synchronization Commands

SSP provides an example user script that shows how the synchronization commands can be used. This script is located in the /opt/SUNWssp/examples/cmdsync directory. This directory also contains a README file that explains how the script works.