Top
ETERNUS SF AdvancedCopy Manager V15.0 Operation Guide

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: # Copyright FUJITSU LIMITED, 2002-2012
  5: 
  6: #
  7: #   Postprocessing 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 | /bin/grep "/dev/sd"`" != "" ]
 28: then
 29:    # /dev/sd? -> sd?
 30:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 31: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ]
 32: then
 33:    # /dev/vd? -> vd?
 34:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 35: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
 36: then
 37:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 38:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 39:    dev="`echo $device | /bin/cut -d/ -f5`"
 40: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 41: then
 42:    if [ "`echo $device | /bin/grep ":"`" != ""   ]
 43:    then
 44:            devnam="`echo $device | /bin/cut -d: -f2-`"
 45:            # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 46:            dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 47:            dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 48:            dev="`echo $dev | /bin/sed "s/:/_/"`"
 49:            device="`echo $device | /bin/cut -d: -f1`"
 50:            if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 51:            then
 52:                    # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
 53:                    dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 54:            elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 55:            then
 56:                    # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
 57:                    dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 58:            fi
 59:    else
 60:            # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 61:            dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 62:            dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 63:    fi
 64: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
 65: then
 66:    # /dev/vx/dmp/device -> _vx_pv_device
 67:    dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
 68: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
 69: then
 70:    # "/dev/mapper/<device>" -> "_mapper_<device>"
 71:    dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
 72: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 73: then
 74:    # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 75:    dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 76: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 77: then
 78:    # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 79:    dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 80: else
 81:    exit 0
 82: fi
 83: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
 84: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
 85: 
 86: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 87: 
 88: # Confirmation of postprocessing
 89: if [ ! -r $post_file ]
 90: then
 91:    exit 0
 92: fi
 93: post="`/bin/cat $post_file | /bin/cut -d',' -f1`"
 94: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`"
 95: 
 96: # Confirmation of FStype
 97: if [ ! -r $fstype_file ]
 98: then
 99:    fs=""
100: else
101:    fs="`/bin/cat $fstype_file`"
102: fi
103: 
104: # No processing
105: if [ "$post" = "none" ]
106: then
107: 	/bin/rm -rf $post_file 2> /dev/null
108: 	/bin/rm -rf $fstype_file 2> /dev/null
109: 	exit 0
110: fi
111: 
112: # mount processing
113: if [ "$post" = "mount" ]
114: then
115:    if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
116:            -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
117:    then
118:            cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
119:            Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
120:    else
121:            Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
122:    fi
123:         if [ "$Result" != "1" ]
124:    then
125:            if [ ! -r $fstype_file ]
126:            then
127:                    /bin/mount $device $mount_point 2> /dev/null
128:            else
129:                    Result1="`echo $fs | /bin/awk 'END {print NR}'`"
130:                    if [ "$Result1" != "1" ]
131:                    then
132:                            /bin/mount $device $mount_point 2> /dev/null
133:                    else
134:                            /bin/mount -t $fs $device $mount_point 2> /dev/null
135:                    fi
136:            fi
137:            if [ $? != 0 ]
138:            then
139:                    retry_count=3
140:                    sleep_time=1
141:                    result_flag=1
142: 
143:                    while [ $retry_count -gt 0 ]
144:                    do
145:                            if [ ! -r $fstype_file ]
146:                            then
147:                                    /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
148:                            else
149:                                    Result1="`echo $fs | /bin/awk 'END {print NR}'`"
150:                                    if [ "$Result1" != "1" ]
151:                                    then
152:                                            /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
153:                                    else
154:                                            /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
155:                                    fi
156:                            fi
157:                            if [ $? != 0 ]
158:                            then
159:                                    retry_count=`expr $retry_count - 1`
160:                                    /bin/sleep $sleep_time
161:                            else
162:                                    /bin/rm -f $err_log_path/$dev.mount
163:                                    result_flag=0
164:                                    break
165:                            fi
166:                    done
167: 
168:                    if [ $result_flag != 0 ]
169:                    then
170:                            exit 11
171:                    fi
172:            fi
173:    fi
174:    /bin/rm -rf $post_file 2> /dev/null
175:    /bin/rm -rf $fstype_file 2> /dev/null
176:    exit 0
177: fi
178: 
179: exit 0

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

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # Copyright FUJITSU LIMITED, 2002-2012
  5: 
  6: #
  7: #   Postprocessing 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: 
 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 | /bin/grep "/dev/sd"`" != "" ]
 28: then
 29:    # /dev/sd? -> sd?
 30:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 31: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ]
 32: then
 33:    # /dev/vd? -> vd?
 34:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 35: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
 36: then
 37:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 38:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 39:    dev="`echo $device | /bin/cut -d/ -f5`"
 40: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 41: then
 42:    if [ "`echo $device | /bin/grep ":"`" != ""   ]
 43:    then
 44:           devnam="`echo $device | /bin/cut -d: -f2-`"
 45:           # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 46:           dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 47:           dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 48:           dev="`echo $dev | /bin/sed "s/:/_/"`"
 49:           device="`echo $device | /bin/cut -d: -f1`"
 50:           if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 51:           then
 52:                  # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
 53:                  dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 54:           elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 55:           then
 56:                   # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
 57:                   dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 58:            fi
 59:    else
 60:            # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 61:            dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 62:            dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 63:    fi
 64: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
 65: then
 66:    # /dev/vx/dmp/device -> _vx_pv_device
 67:    dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
 68: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
 69: then
 70:    # "/dev/mapper/<device>" -> "_mapper_<device>"
 71:    dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
 72: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 73: then
 74:    # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 75:    dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 76: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 77: then
 78:    # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 79:    dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 80: else
 81:    exit 0
 82: fi
 83: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
 84: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype"
 85: 
 86: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
 87: 
 88: # Confirmation of postprocessing
 89: if [ ! -r $post_file ]
 90: then
 91:    exit 0
 92: fi
 93: post="`/bin/cat $post_file | /bin/cut -d',' -f1`"
 94: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`"
 95: 
 96: # Confirmation of FStype
 97: if [ ! -r $fstype_file ]
 98: then
 99:    fs=""
100: else
101:    fs="`/bin/cat $fstype_file`"
102: fi
103: 
104: # No processing
105: if [ "$post" = "none" ]
106: then
107:    /bin/rm -rf $post_file 2> /dev/null
108:    /bin/rm -rf $fstype_file 2> /dev/null
109:    exit 0
110: fi
111: 
112: # mount processing
113: if [ "$post" = "mount" ]
114: then
115: #  df -l $device > /dev/null 2>&1
116: #  if [ $? != 0 ]
117:    if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
118:            -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
119:    then
120:            cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
121:            Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
122:    else
123:            Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
124:    fi
125:      if [ "$Result" != "1" ]
126:    then
127:            if [ ! -r $fstype_file ]
128:            then
129:                    /bin/mount $device $mount_point 2> /dev/null
130:            else
131:                    Result1="`echo $fs | /bin/awk 'END {print NR}'`"
132:                    if [ "$Result1" != "1" ]
133:                    then
134:                            /bin/mount $device $mount_point 2> /dev/null
135:                    else
136:                            /bin/mount -t $fs $device $mount_point 2> /dev/null
137:                    fi
138:            fi
139:            if [ $? != 0 ]
140:            then
141:                    retry_count=3
142:                    sleep_time=1
143:                    result_flag=1
144: 
145:                    while [ $retry_count -gt 0 ]
146:                    do
147:                            if [ ! -r $fstype_file ]
148:                            then
149:                                   /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
150:                            else
151:                                  Result1="`echo $fs | /bin/awk 'END {print NR}'`"
152:                                  if [ "$Result1" != "1" ]
153:                                  then
154:                                          /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
155:                                  else
156:                                          /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
157:                                  fi
158:                            fi
159:                            if [ $? != 0 ]
160:                            then
161:                                    retry_count=`expr $retry_count - 1`
162:                                    /bin/sleep $sleep_time
163:                            else
164:                                    /bin/rm -f $err_log_path/$dev.mount
165:                                    result_flag=0
166:                                    break
167:                            fi
168:                    done
169: 
170:                    if [ $result_flag != 0 ]
171:                    then
172:                            exit 11
173:                    fi
174:            fi
175:    fi
176:    /bin/rm -rf $post_file 2> /dev/null
177:    /bin/rm -rf $fstype_file 2> /dev/null
178:    exit 0
179: fi
180: 
181: exit 0