Sie sind auf Seite 1von 5

#!

/bin/sh
#
# runcluvfy.sh
#
# Usage: runcluvfy.sh <cluvfy command options>
#
# OPTIONAL INPUTS:
#
CV_HOME - Location to put cluster verification software. If
not set
#
will default to TMPDIR.
#
#
CV_DESTLOC - Points to a directory on each (remote as well as
local)
#
node that is writable. The cluster verifcation
tool will
#
copy the required software bits (on need basis)
to this
#
directory. If not set will default to TMPDIR.
#
# This script sets up the environment for invocation of the
cluster
# verification tool (cluvfy). It bootstraps the environment with
the
# correct version of JDK needed and the CVU software. This script
then
# executes the requested verification command, and cleans up the
space
# occupied by the JDK and CVU verification software.
#
# Setup variables/symbols used in this script.
ECHO=/bin/echo
RM=/bin/rm
MKDIR=/bin/mkdir
DIRNAME=/usr/bin/dirname
EXEC_DIR=`$DIRNAME $0`
RCLUVFY=_FROM_RUNCLUVFY
AWK=/bin/awk
ID=/usr/bin/id
CP=/bin/cp
#Request user to run 'dns' component checks as root from grid
infrastructure home only
if [ "X$1" = "Xcomp" -a "X$2" = "Xdns" ]; then
$ECHO "The command for '$2' component check should not be run
using 'runcluvfy'. This command should be run using '<Grid
Infrastructure Home>/bin/cluvfy $1 $2' if Grid Infrastructure has
been configured."
exit 3
fi
if [ "X$TMPDIR" = "X" ]

then
TMPDIR=/tmp
fi
#Check is invoked as root, If Invoked by root user then exit
Displaying relevant error message
RUID=`$ID -u 1> /dev/null 2>&1`
status=$?
if [ "$status" != "0" ];
then
RUID=`$ID | $AWK -F\( '{print $1}' | $AWK -F= '{ print $2}'`
else
RUID=`$ID -u`
fi
if [ -z "$RUID" ];
then
$ECHO "Failed to get effective user id using command $ID"
exit 1
fi
if [ "${RUID}" = "0" ];
then
$ECHO "You must NOT be logged in as root (uid=0) when running
$0."
exit 1
fi
if [ "X$1" = "X" ]
then
$ECHO "$0 "
$ECHO " Sets up the environment needed to run the 'cluvfy'
utility"
$ECHO " and then runs the 'cluvfy' utility with the options
specified."
$ECHO " Please see the 'cluvfy' documentation for further
details."
$ECHO
$ECHO "Usage:"
$ECHO " $0 <cluvfy command options>"
$ECHO
exit 2
fi
# See if CV_HOME is defined already. If so use that definition
for the boot
# location, otherwise set CV_HOME to point to location identified
by TMPDIR.
# Add the directory 'bootstrap' to this location to identify what
we are doing.

if [ "X$CV_HOME" = "X" ]
then
CV_HOME=$TMPDIR/bootstrap
else
CV_HOME=$CV_HOME/bootstrap
fi
export CV_HOME
# The JDK is going to be loaded into the bootstrap location but
in its own
# directory. Make sure CV_JDKHOME points to this directory.
CV_JDKHOME=$CV_HOME/jdk
export CV_JDKHOME
# See if CV_DESTLOC is defined already. If so use that definition
otherwise
# set CV_DESTLOC to point to location identified by TMPDIR.
if [ "X$CV_DESTLOC" = "X" ]
then
CV_DESTLOC=$TMPDIR
fi
export CV_DESTLOC
# Process any port specific requirements...
case `/bin/uname` in
Linux)
;;
HP-UX)
;;
SunOS)
;;
AIX)
;;
OSF1)
;;
*)
$ECHO "ERROR: Unknown Operating system"
exit -1;
;;
esac
# Clean out the contents of CV_HOME incase something was left
there.
$RM -rf $CV_HOME
$MKDIR -p $CV_HOME
# Install the JDK and CVU components into a bootstrap directory
so we can
# run cluvfy (note use oui)
# If cvu.ini exists, then we are in CRS shiphome, else we are at
the
# top-level and need to execute CVU from CRS shiphome location.

if [ -f ${EXEC_DIR}/install/cvu.ini ]
then
# Bootstrap CVU from the current location (i.e. we should be
set to CRS Shiphome)
${EXEC_DIR}/install/.oui -paramFile $
{EXEC_DIR}/install/cvu.ini -bootstraponly BOOTSTRAP_LOC=$CV_HOME
> $CV_HOME/ouibootstrap.log
else
# Bootstrap CVU from CRS Shiphome location.
${EXEC_DIR}/clusterware/Disk1/install/.oui -paramFile $
{EXEC_DIR}/clusterware/Disk1/install/cvu.ini -bootstraponly
BOOTSTRAP_LOC=$CV_HOME > $CV_HOME/ouibootstrap.log
fi
OUI_STATUS=$?
# If we encountered an error while running OUI, output the log
file containing
# the errors, cleanup and then exit.
if [ $OUI_STATUS -ne 0 -a -f $CV_HOME/ouibootstrap.log ]
then
cat $CV_HOME/ouibootstrap.log
fi
# Delete the log file if it exists.
if [ -f $CV_HOME/ouibootstrap.log ]
then
$RM $CV_HOME/ouibootstrap.log
fi
if [ $OUI_STATUS -ne 0 ]
then
exit $OUI_STATUS
fi
#copy oifcfg to CV_HOME
$CP ${EXEC_DIR}/stage/ext/bin/oifcfg $CV_HOME/bin
$CP ${EXEC_DIR}/stage/ext/bin/kfod.bin $CV_HOME/bin
$CP ${EXEC_DIR}/stage/cvu/cv/admin/cvunetquery $CV_HOME/bin
$CP ${EXEC_DIR}/stage/ext/lib/* $CV_HOME/lib
#copy lsnodes.bin as lsnodes
$CP $CV_HOME/bin/lsnodes.bin $CV_HOME/bin/lsnodes
#copy cluvfy.sbs as cluvfy
$CP $CV_HOME/crs/sbs/cluvfy.sbs $CV_HOME/bin/cluvfy
# Execute the requested cluster verification command
${CV_HOME}/bin/cluvfy "$@" "$RCLUVFY"
EXEC_STATUS=$?
# Cleanup the home for cluster verification software

$RM -rf $CV_HOME


# Return the status of executed cluster verification command
exit $EXEC_STATUS

Das könnte Ihnen auch gefallen