Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Help

Status
Not open for further replies.
Oct 9, 2003
174
US
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
#


 
Could it be that the comparison on the left side is an empty string?

Check with:

echo `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep OK | nawk -F ' ' '{print $1}'`

HTH

mrjazz
 
Replace this:
[ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep OK | nawk -F ' ' '{print $1}'` != $TEST_STR ]
By this:
[ [highlight]"[/highlight]`/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep OK | nawk -F ' ' '{print $1}'`[highlight]"[/highlight] != $TEST_STR ]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top