telemorgan
MIS
Im getting this error when trying to run the script below via the cron. Pleas advise. Thanks in advance.
::::: ERROR ::::::
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
::::: SCRIPT :::::
#!/bin/ksh
#
# SET GLOBAL VARIABLES
MYMSG_GD="/morgan/working/system_good.txt" # ouput for successful tests
MYMSG_BD="/morgan/working/system_bad.txt" # ouput for failed tests
DB="deltekcp griffon epay deltektc testcp" # database names
TEST_STR="OK" # SQL test string
#
# SQL DB TEST
#
for x in $DB ; do
if [ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep OK | nawk -F ' ' '{print $1}'` != $TEST_STR ] ; then
echo "$x : down" >> $MYMSG_BD # NO, echo message
else
echo "$x : up" >> $MYMSG_GD # Yes, echo message
fi
done
#
::::: ERROR ::::::
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
system_test.scr[36]: test: argument expected
::::: SCRIPT :::::
#!/bin/ksh
#
# SET GLOBAL VARIABLES
MYMSG_GD="/morgan/working/system_good.txt" # ouput for successful tests
MYMSG_BD="/morgan/working/system_bad.txt" # ouput for failed tests
DB="deltekcp griffon epay deltektc testcp" # database names
TEST_STR="OK" # SQL test string
#
# SQL DB TEST
#
for x in $DB ; do
if [ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep OK | nawk -F ' ' '{print $1}'` != $TEST_STR ] ; then
echo "$x : down" >> $MYMSG_BD # NO, echo message
else
echo "$x : up" >> $MYMSG_GD # Yes, echo message
fi
done
#