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

付録C レプリケーションの前後処理> C.2 レプリケーションの前後処理

C.2.3 レプリケーション実行時の後処理

後処理スクリプトには複写元ボリューム(RepSrc.Post)と複写先ボリューム(RepDst.Post)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてスクリプトをカスタマイズしてください。

RepSrc.post(複写元ボリューム後処理スクリプト)

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

 

RepDst.post(複写先ボリューム後処理スクリプト)

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

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

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