Scripting Debugging Help

From: Chris cc (lazyboy_2k@yahoo.com)
Date: Mon Feb 11 2008 - 15:04:08 EST


Hi Gurus,

Am I missing anything or having some sort of syntax errors in this script? Any helps/assistants are GREATLY APPRECIATED. Thanks in advance.

 # ./iioradata oradata1
+ DATE=/usr/bin/date
+ echo Beginning of main function
Beginning of main function
+ [ oradata1 = ]
+ [ oradata1 != ]
+ echo inputing.....
 inputing.....
+ f_input
SORRY Parameters don't match

HERE IS THE ACTUAL SCRIPT:

  DATE=/usr/bin/date
  f_usage()
  {
     echo "USAGE: iioradata <oradata1 | oradata2>"
  }
   
  f_input()
  {
     if [[ "$1" == "oradata1" ]]
     then
          DBInstance="PROD"
          SCRPTNAME="oradata1" # PROD dataset
          SHDODvol=/dev/dsk/emcpower7a
          MNTPT=/global/oradata1
          RAWSHD=/dev/rdsk/emcpower7a
     elif [[ "$1" == "oradata2" ]]
     then
          DBInstance="TCFE"
          SCRPTNAME="oradata2" # TCFE dataset
          SHDODvol=/dev/dsk/emcpower6a
          MNTPT=/global/oradata2
          RAWSHD=/dev/rdsk/emcpower6a
     else
          echo "SORRY Parameters don't match"
          exit
     fi
  }
   
  f_messages()
  {
     MNTODout=`/usr/sbin/mount | grep $SHDODvol | awk '{ print $1}'`
     UNMOUNT_Success="TRUE"
   
     if [ "$MNTODout" != "" ]; then
          echo "\n $SCRPTNAME`$DATE` These volumes are mounted ... need to umount \n"
          UNMOUNT_Success="FALSE"
          if [ "$MNTODout" != "" ]; then
                  echo "$SCRPTNAME`$DATE` $SHDODvol"
                  echo "\n $SCRPTNAME`$DATE` Trying to UnMount \n"
                  ERRORSHD=`/usr/sbin/umount -f $SHDODvol`
                  if [ "$ERRORSHD" != "" ]; then
                          echo "$SCRPTNAME`$DATE` Couldn't UNMOUNT because of $ERRORSHD"
                          echo "$SCRPTNAME`$DATE` Correct the error and try again"
                          UNMOUNT_Success="FALSE"
                  else
                          UNMOUNT_Success="TRUE"
                  fi
          fi
     fi
  }
   
  f_II()
  {
     HOTBACKUP_ON="/export/home/oracle/scripts/hotbackup/hotbackup_on"
     HOTBACKUP_OFF="/export/home/oracle/scripts/hotbackup/hotbackup_off"
     echo "\n $SCRPTNAME`$DATE` Putting Databases in HOT-BACKUP mode \n"
     /usr/bin/su - oracle -c "$HOTBACKUP_ON $DBInstance" > /dev/null
     echo "\n $SCRPTNAME`$DATE` Starting Update of the Shadow Volumes (DATA FILES)"
     /usr/sbin/iiadm -u s $RAWSHD
     echo "\n $SCRPTNAME`$DATE` Waiting for the Snap Shot to finish (DATA FILES)"
     /usr/sbin/iiadm -w $RAWSHD
     echo "\n $SCRPTNAME`$DATE` Taking Databases out of HOT-BACKUP mode"
     /usr/bin/su - oracle -c "$HOTBACKUP_OFF $DBInstance" > /dev/null
     echo "\n $SCRPTNAME`$DATE` Mounting the Volumes back"
     /usr/sbin/mount $SHDODvol
  }
  # Main function
  if [ "$1" = "" ]; then
     f_usage
     echo " I am here "
  elif [ "$1" != "" ];then
     echo " inputing....."
     f_input
     echo "====Script Started $SCRPTNAME`$DATE`===="
     echo "messages....."
     f_messages
     if [ "$UNMOUNT_Success" = "TRUE" ]; then
  # f_II
          :
     else
          echo "\n $SCRPTNAME`$DATE` Couldn't UNMOUNT one or more shadow volumes \n"
          echo "\n$ SCRPTNAME`$DATE` Try Unmounting manually and try again. \n"
     fi
     echo "\n ===== Script Ended $SCRPTNAME`$DATE` ====="
  fi
  TIA,
-Chris

       
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:42:46 EDT