Top
ETERNUS SF AdvancedCopy Manager V15.1 Operation Guide
ETERNUS

C.2.2 Pre-processing when replication is executed

The replication source volume script (RepSrc.pre) and the replication destination volume script (RepDst.pre) are prepared for a pre-processing script, and it is stored in the following directory. Please customize these scripts according to the processing requirements.

In the case of non-cluster operation
/etc/opt/FJSVswsrp/sh
In the case of cluster operation
/etc/opt/FJSVswsrp/<logical node name>/sh

C.2.2.1 Replication source volume pre-processing sample script (RepSrc.pre)

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5: 
  6: #
  7: #   Pre-processing of Replication(Source) processing
  8: #
  9: #       Argument: $1 Device name of Source disk
 10: #                 $2 Mount point of Source disk
 11: #
 12: #   Error number
 13: #        2: Argument error
 14: #       10: umount error
 15: 
 16: # Argument check
 17: case $# in
 18: 2)
 19:    ;;
 20: *)
 21:    exit 2
 22:    ;;
 23: esac
 24: 
 25: device=$1
 26: mount_point=$2
 27: 
 28: # Determination postprocessing file name
 29: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
 30: then
 31:    # /dev/dsk/c?t?d?s? -> c?t?d?s?
 32:    dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
 33: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
 34: then
 35:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 36:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 37:    dev="`echo $device | /usr/bin/cut -d/ -f5`"
 38: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
 39: then
 40:    if [ "`echo $device | /usr/bin/grep ":"`" != ""   ]
 41:    then
 42:       # /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
 43:       dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 44:       dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 45:       dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
 46:       device="`echo $device | /usr/bin/cut -d: -f1`"
 47:    else
 48:        # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 49:        dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 50:        dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 51:    fi
 52: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
 53: then
 54:    # /dev/vx/dsk/volume -> _vx_rootdg_volume
 55:    # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
 56:    dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
 57: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 58: then
 59:    # /dev/vx/dmp/device -> _vx_pv_device
 60:    dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
 61: else
 62:    exit 0
 63: fi
 64: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
 65: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
 66: 
 67: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 68: 
 69: if [ "$mount_point" != "" ]
 70: # When device was mounted
 71: #
 72: then
 73: 
 74: # When device cannot be unmounted
 75: #
 76: #  if [ "$device" = "/dev/dsk/cXtXdXsX" -o "$device" = "/dev/dsk/cYtYdYsY" ]
 77: #  then
 78: #     /usr/sbin/lockfs -w $mount_point > /dev/null 2>&1
 79: #     echo "lockfs,$mount_point" > $post_file
 80: #
 81: # When device can be unmounted
 82: #
 83: #  else
 84: #
 85:       /usr/bin/df -ln $mount_point | /usr/bin/cut -f2 -d: | /usr/bin/cut -f2 -d' ' > $fstype_file
 86: 
 87:       /usr/sbin/umount $mount_point 2>/dev/null
 88: 
 89:       if [ $? != 0 ]
 90:       then
 91:          retry_count=3
 92:          sleep_time=1
 93:          result_flag=1
 94: 
 95:          while [ $retry_count -gt 0 ]
 96:          do
 97:             /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 98:             if [ $? != 0 ]
 99:             then
100:                retry_count=`expr $retry_count - 1`
101:                /usr/bin/sleep $sleep_time
102:             else
103:                /usr/bin/rm -f $err_log_path/$dev.umount
104:                result_flag=0
105:                break
106:             fi
107:          done
108: 
109:          if [ $result_flag != 0 ]
110:          then
111:             /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
112:             /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
113:             exit 10
114:          fi
115:       fi
116: 
117:       echo "mount,$mount_point" > $post_file
118: 
119: #  fi
120: 
121: # When device was not mounted
122: #
123: else
124:    echo "none" > $post_file
125: fi
126: 
127: exit 0

C.2.2.2 Replication destination volume pre-processing sample script (RepDst.pre)

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5: 
  6: #
  7: #   Pre-processing of Replication(Destination) processing
  8: #
  9: #       Argument: $1 Device name of Destination disk
 10: #                 $2 Mount point of Destination disk
 11: #
 12: #    Error number
 13: #        2: Argument error(system error)
 14: #       10: umount error
 15: 
 16: # Argument check
 17: case $# in
 18: 2)
 19:    ;;
 20: *)
 21:    exit 2
 22:    ;;
 23: esac
 24: 
 25: device=$1
 26: mount_point=$2
 27: 
 28: # Determination postprocessing file name
 29: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
 30: then
 31:    # /dev/dsk/c?t?d?s? -> c?t?d?s?
 32:    dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
 33: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
 34: then
 35:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 36:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 37:    dev="`echo $device | /usr/bin/cut -d/ -f5`"
 38: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
 39: then
 40:    if [ "`echo $device | /usr/bin/grep ":"`" != ""   ]
 41:    then
 42:       # /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
 43:       dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 44:       dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 45:       dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
 46:       device="`echo $device | /usr/bin/cut -d: -f1`"
 47:    else
 48:       # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 49:       dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 50:       dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 51:       post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
 52:    fi
 53: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
 54: then
 55:    # /dev/vx/dsk/volume -> _vx_rootdg_volume
 56:    # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
 57:    dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
 58: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 59: then
 60:    # /dev/vx/dmp/device -> _vx_pv_device
 61:    dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
 62: else
 63:    exit 0
 64: fi
 65: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
 66: 
 67: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 68: 
 69: if [ "$mount_point" != "" ]
 70: # When device was mounted
 71: #
 72: then
 73: 
 74:    /usr/sbin/umount $mount_point 2>/dev/null
 75: 
 76:    if [ $? != 0 ]
 77:    then
 78:       retry_count=3
 79:       sleep_time=1
 80:       result_flag=1
 81: 
 82:       while [ $retry_count -gt 0 ]
 83:       do
 84:          /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 85:          if [ $? != 0 ]
 86:          then
 87:             retry_count=`expr $retry_count - 1`
 88:             /usr/bin/sleep $sleep_time
 89:          else
 90:             /usr/bin/rm -f $err_log_path/$dev.umount
 91:             result_flag=0
 92:             break
 93:          fi
 94:       done
 95: 
 96:       if [ $result_flag != 0 ]
 97:       then
 98:          /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
 99:          /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
100:          exit 10
101:      fi
102:    fi
103: 
104:    echo "mount,$mount_point" > $post_file
105: 
106: # When device was not mounted
107: #
108: else
109:    echo "none" > $post_file
110: fi
111: 
112: exit 0