#!/bin/ksh
# @(#)95	1.3  src/avs/fs/mmfs/ts/config/syncfsconfig.sample, mmfs, avs_rgpfs24, rgpfs240610b 11/1/04 16:23:45 
##############################################################################
#
# When properly installed, this script will be invoked after each
# GPFS administration command that may change the configuration of
# a GPFS file system.  Examples of such changes include:
# - creation or deletion of GPFS file systems (mmcrfs, mmdelfs)
# - addition or removal of disks (mmadddisk, mmdeldisk, mmrpldisk)
# - changing of a mount point or some other mount attribute (mmchfs)
#
# This script can be used to keep the file system configuration data
# in replicated GPFS clusters automatically synchronized.
#
# 
# INSTALLATION GUIDELINES FOR THIS SCRIPT
#
#   a) edit this script using the guidelines below
#   b) copy this script to /var/mmfs/etc/syncfsconfig
#   c) ensure this script is executable: chmod +x /var/mmfs/etc/syncfsconfig
#
#   Since mm commands can be started on any node in the cluster,
#   it is suggested that this script is installed on all nodes.
#
#
# DESCRIPTION OF THE CROSS-CLUSTER SYNCHRONIZATION PROCESS
#
#   The synchronization of the file system configuration data in two
#   GPFS clusters can be accomplished by invoking mmfsctl syncFSconfig.
#   This command uses variations of the GPFS mmexportfs and mmimportfs
#   commands to extract relevant information from the source cluster
#   configuration data (mmsdrfs file) and restore it in the target
#   cluster's configuration data.
#
# 
# CONFIGURATION AND EDITING GUIDELINES
#
#   This script will always be invoked synchronously.  It is up to
#   the user to decide whether the tasks coded in this script will
#   be performed synchronously as well, and as a result, the return
#   from the invoking mm command delayed until this script completes.
#   Or, alternatively, the tasks coded in this script can be started
#   in the background and control returned to the invoking command. 
# 
#   Similarly, it is up to the user to decide whether any output
#   generated by this script will show up as part of the output
#   of the invoking GPFS command, or whether such output will be
#   send to some log file or discarded altogether.
# 
#
# INPUT FILES
#
#   The mmfsctl syncFSconfig command expects the following files:
#
#   targetNodesFile  The path name to a file containing, one per line,
#                    hostnames or IP addresses of nodes that belong to
#                    the target cluster.  It is suggested that you
#                    list more than one node in this file to reduce
#                    the risk of failure due to node unavailability.
#
#                    Note: targetNodesFile must be installed on all
#                          nodes in the local cluster on which this
#                          script has been activated.
#
#   nsdSpecFile      The path name to a file with the NSD server designations
#                    in the target cluster for all affected disks.  The file
#                    format is the same as for the -S parameter of mmimportfs.
#
#                    Note: nsdSpecFile refers to a file in the target cluster.
#                          It must exist on all nodes listed in targetNodesFile.
#
##############################################################################

# Initialize path names.
mmfsctl=/usr/lpp/mmfs/bin/mmfsctl
# targetNodesFile=
# nsdSpecFile=

# Define log file for error messages.
logFile=/dev/null


# Uncomment the following line if you want the command to be executed
# synchronously and all output appear on the console.

# $mmfsctl all syncFSconfig -n $targetNodesFile -S $nsdSpecFile


# Uncomment the following line if you want the command to be executed
# asynchronously and all output redirected to a log file or /dev/null.

# $mmfsctl all syncFSconfig -n $targetNodesFile -S $nsdSpecFile >$logFile 2>&1 &

return 0

