Top
ETERNUS SF AdvancedCopy Manager V15.1 Operation Guide
ETERNUS

A.2.1 Pre-processing of backup

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

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

A.2.1.1 Pre-processing script for backup

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