Hi guys, hope you scripting gurus here can help me out, the logic in my script somehow not working the way it should, this script part of a bigger backup script suppose to do some checking on the cluster prior to bringing up the package on MC/SG after backend cloning operation, this portion is suppose to check switching parameter if it is disabled, if so then turn it on with command "cmmodpkg -v -e -n hostname package_name", somehow it's not working.
Quote:
#!/bin/ksh
export PRISTAT=`/usr/sbin/cmviewcl -v | grep -i current | awk '{ print $3 }'`
export SECSTAT=`/usr/sbin/cmviewcl -v | grep -i alternate | awk '{ print $3 }'`
#
check_switching_mode()
{
# Check Primary node
if [ $PRISTAT!="enabled" ]
then
echo $PRISTAT
echo "cmmodpkg -v -e -n PRIMARY PACKAGE_NAME"
else
echo "switching mode on Primary is already enabled"
fi
# Check Secondary node
if [ $SECSTAT!="enabled" ]
then
echo $SECSTAT
echo "cmmodpkg -v -e -n SECONDARY PACKAGE_NAME"
else
echo "switching mode on Secondary is already enabled"
fi
}
check_switching_mode
when I run it the output is like this
# ./ccc
enabled <<<--- from echo $PRISTAT
cmmodpkg -v -e -n PRIMARY PACKAGE_NAME <<<--- this is wrong output
enabled <<<-- from echo $SECSTAT
cmmodpkg -v -e -n SECONDARY PACKAGE_NAME <<< -- this also wrong output
which is wrong.
the output from cmviewcl
# /usr/sbin/cmviewcl -v | grep -i current | awk '{ print $3 }'
enabled
# /usr/sbin/cmviewcl -v | grep -i alterna | awk '{ print $3 }'
enabled
can somebody pls help me.