Top
ETERNUS SFAdvancedCopy Manager 14.0 Operator's Guide forTape Server Option

A.4.1 Tape copy pre-processing in Solaris

The name of the shell script for pre-processing before tape copy processing is as follows.

Content of shell script

  1: #!/bin/sh
  2:
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2007
  5:
  6: #
  7: #   Pre-processing of tape copy processing
  8: #
  9: #       Argument: $1 Device name of backup disk
 10: #                 $2 Reserve
 11: #
 12: #       Error number
 13: #                2: Argument error
 14: #               10: umount error
 15:
 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:
 30: # Determine post-processing file name
 31:
 32: if [ "$SWSTGNODE" != "" ]
 33: then
 34:         swstg_node="/`echo $SWSTGNODE`"
 35: else
 36:         swstg_node=""
 37: fi
 38:
 39: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
 40:
 41: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
 42: then
 43:         # /dev/dsk/c?t?d?s? -> c?t?d?s?
 44:         dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
 45: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
 46: then
 47:         # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s?
 48:         # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s?
 49:         dev="`echo $device | /usr/bin/cut -d/ -f5`"
 50: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
 51: then
 52:         # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 53:         dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
 54:         dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
 55: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
 56: then
 57:         # /dev/vx/dsk/volume -> _vx_rootdg_volume
 58:         # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
 59:         dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
 60: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 61: then
 62:         # /dev/vx/dmp/device -> _vx_pv_device
 63:         dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
 64: else
 65:         exit 0
 66: fi
 67: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 68:
 69: # Device unmount process.
 70: #
 71: cur_mount_point=`/usr/sbin/mount | grep "$device " | cut -f1 -d' '`
 72: if [ "$cur_mount_point" != "" ]
 73: then
 74:         /usr/sbin/umount $cur_mount_point 2>/dev/null
 75:         if [ $? != 0 ]
 76:         then
 77:                 retry_count=3
 78:                 sleep_time=1
 79:                 result_flag=1
 80:
 81:                 while [ $retry_count -gt 0 ]
 82:                 do
 83:                         /usr/sbin/umount $cur_mount_point > $err_log_path/$dev.umount 2>&1
 84:                         if [ $? != 0 ]
 85:                         then
 86:                                 retry_count=`expr $retry_count - 1`
 87:                                 /usr/bin/sleep $sleep_time
 88:                         else
 89:                                 /usr/bin/rm -f $err_log_path/$dev.umount
 90:                                 result_flag=0
 91:                                 break
 92:                         fi
 93:                 done
 94:
 95:                 if [ $result_flag != 0 ]
 96:                 then
 97:                         /usr/sbin/fuser -cu $cur_mount_point> $err_log_path/$dev.fuser 2>&1
 98:                         /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1
 99:
100:                         exit 10
101:                 fi
102:         fi
103:         echo "mount" > $post_file
104:
105: # When device was not mounted
106: #
107: else
108:         echo "none" > $post_file
109: fi
110: exit 0