Top
ETERNUS SF AdvancedCopy Manager V15.1 Operation Guide
ETERNUS

C.2.3 Post-processing when replication is executed

The replication source volume script (RepSrc.post) and the replication destination volume script (RepDst.post) are prepared for a post-processing script, which is stored in the following directory. This script must be customized 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.3.1 Replication source volume post-processing sample script (RepSrc.post)

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

C.2.3.2 Replication destination volume post-processing sample script (RepDst.post)

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5: 
  6: #
  7: #   Post-processing of Replication(Destination) processing
  8: #
  9: #        Argument: $1 Device name of Destination disk
 10: #
 11: #        Error number
 12: #               2: Argument error
 13: #              11: mount error
 14: #              12: fsck error
 15: 
 16: # Argument check
 17: case $# in
 18: 1)
 19: 	;;
 20: *)
 21: 	exit 2
 22: 	;;
 23: esac
 24: 
 25: device=$1
 26: 
 27: # Determination of postprocessing file name
 28: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
 29: then
 30: 	# /dev/dsk/c?t?d?s? -> c?t?d?s?
 31: 	dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
 32: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
 33: then
 34: 	# /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 35: 	# /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 36: 	dev="`echo $device | /usr/bin/cut -d/ -f5`"
 37: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
 38: then
 39: 	if [ "`echo $device | /usr/bin/grep ":"`" != ""   ]
 40: 	then
 41: 		# /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
 42: 		dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 43: 		dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 44: 		dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
 45: 		device="`echo $device | /usr/bin/cut -d: -f1`"
 46: 	else
 47: 		# /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 48: 		dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 49: 		dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 50: 	fi
 51: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
 52: then
 53: 	# /dev/vx/dsk/volume -> _vx_rootdg_volume
 54: 	# /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
 55: 	dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
 56: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 57: then
 58: 	# /dev/vx/dmp/device -> _vx_pv_device
 59: 	dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
 60: else
 61: 	exit 0
 62: fi
 63: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
 64: 
 65: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 66: 
 67: # Confirmation of postprocessing
 68: if [ ! -r $post_file ]
 69: then
 70: 	exit 0
 71: fi
 72: post="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f1`"
 73: mount_point="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f2`"
 74: 
 75: # Confirmation of FStype
 76: fs="`/usr/sbin/fstyp $device 2> /dev/null`"
 77: if [ $? != 0 ]
 78: then
 79: 	fs=""
 80: fi
 81: 
 82: # When source device cannot be unmounted, fsck for destination device is needed
 83: #
 84: #if [ "$device" = "/dev/dsk/cXtXdXsX" -o "$device" = "/dev/dsk/cYtYdYsY" ]
 85: #then
 86: #   fsck_dev="`echo $device | sed "s/\/dsk\//\/rdsk\//"`"
 87: #
 88: #   if [ "$fs" = "" ]
 89: #   then
 90: #      fsck -m $fsck_dev > /dev/null 2>&1
 91: #   else
 92: #      if [ "$fs" = "sfxfs" ]
 93: #      then
 94: #         sfxadm $fsck_dev > /dev/null 2>&1
 95: #         fsck -y -F $fs -o p,log $fsck_dev > /dev/null 2>&1
 96: #      else
 97: #         fsck -m -F $fs $fsck_dev > /dev/null 2>&1
 98: #      fi
 99: #   fi
100: #   if [ $? != 0 ]
101: #   then
102: #      if [ "$fs" = "" ]
103: #      then
104: #         result="`fsck -n $fsck_dev |grep \?`"
105: #      else
106: #         result="`fsck -n -F $fs $fsck_dev |grep \?`"
107: #      fi
108: #      if [ "$result" = "FILE SYSTEM STATE IN SUPERBLOCK IS WRONG; FIX?  no" ]
109: #      then
110: #         if [ "$fs" = "" ]
111: #         then
112: #            fsck -y $fsck_dev > /dev/null 2>&1
113: #         else
114: #            fsck -y -F $fs $fsck_dev > /dev/null 2>&1
115: #         fi
116: #         if [ $? != 0 ]
117: #         then
118: #            if [ "$fs" = "" ]
119: #            then
120: #               fsck -y $fsck_dev > $err_log_path/$dev.fsck 2>&1
121: #            else
122: #               fsck -y -F $fs $fsck_dev > $err_log_path/$dev.fsck 2>&1
123: #            fi
124: #            if [ $? != 0 ]
125: #            then
126: #               exit 12
127: #            else
128: #               rm -f $err_log_path/$dev.fsck
129: #            fi
130: #         fi
131: #      else
132: #         echo "$result" > $err_log_path/$dev.fsck
133: #         exit 12
134: #      fi
135: #   fi
136: #fi
137: 
138: # No processing
139: if [ "$post" = "none" ]
140: then
141:    /usr/bin/rm -rf $post_file 2> /dev/null
142:    exit 0
143: fi
144: 
145: # mount processing
146: if [ "$post" = "mount" ]
147: then
148:    /usr/bin/df -l $device > /dev/null 2>&1
149:    if [ $? != 0 ]
150:    then
151:       if [ "$fs" = "" ]
152:       then
153:          /usr/sbin/mount $device $mount_point 2> /dev/null
154:       else
155:          if [ "$fs" = "sfxfs" ]
156:          then
157:             dev="`echo $device | /usr/bin/sed "s/\/dsk\//\/rdsk\//"`"
158:             /usr/sbin/sfxadm $dev > /dev/null 2>&1
159:          fi
160:          /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null
161:       fi
162:       if [ $? != 0 ]
163:       then
164:          retry_count=3
165:          sleep_time=1
166:          result_flag=1
167: 
168:          while [ $retry_count -gt 0 ]
169:          do
170:             if [ "$fs" = "" ]
171:             then
172:                /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
173:             else
174:                if [ "$fs" = "sfxfs" ]
175:                then
176:                   dev="`echo $device | /usr/bin/sed "s/\/dsk\//\/rdsk\//"`"
177:                   /usr/sbin/sfxadm $dev > $err_log_path/$dev.sfxadm 2>&1
178:                fi
179:                /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.sfxadm 2>&1
180:             fi
181:             if [ $? != 0 ]
182:             then
183:                retry_count=`expr $retry_count - 1`
184:                /usr/bin/sleep $sleep_time
185:             else
186:                result_flag=0
187:                break
188:             fi
189:          done
190: 
191:          if [ $result_flag != 0 ]
192:          then
193:             exit 11
194:          fi
195:       fi
196:    fi
197:    /usr/bin/rm -rf $post_file 2> /dev/null
198:    exit 0
199: fi
200: 
201: exit 0