ETERNUS SF AdvancedCopy Manager 運用手引書 13.2 -Linux-
目次 索引 前ページ次ページ

付録A バックアップ/リストアの前後処理> A.3 リストアの前後処理

A.3.2 リストア実行時の後処理

リスト実行時の後処理のシェルスクリプト名は、以下のとおりです。

リストア時の後処理シェルスクリプト

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

目次 索引 前ページ次ページ

All Rights Reserved, Copyright(C) 富士通株式会社 2000-2008