Top
ETERNUS SF AdvancedCopy Manager V15.1 Operation Guide
ETERNUS

A.2.2 Post-processing of backup

The name of a script file for post-processing of a backup is as follows.

In the case of non-cluster operation
/etc/opt/FJSVswsts/sh/OpcBackup.post
In the case of cluster operation
/etc/opt/FJSVswsts/<logic node name>/sh/OpcBackup.post

A.2.2.1 Post-processing script for backup

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