Computing.Net > Forums > Unix > error message in script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

error message in script

Reply to Message Icon

Name: tunde
Date: July 19, 2005 at 06:58:47 Pacific
OS: IBM AIX
CPU/Ram: 6GB
Comment:

I have a script that gives me the following error:
Hi there,

% Used Warn Filesystem Name CURRENT DISKSPACE STATUS
./diskspace.sh[25]: 0403-057 Syntax error at line 70 : `(' is not expected.

The script is shown below:
# set -x
# D I S K S P A C E . S H
#
# 07/02/96
#
# Checks available disk space against a reference table,
# and flags the filesystems that are below their limit.
#

# 10/12/94 Original Version
# 03/06/96 Minor modifications for HP/UX 10.0
# 07/02/96 Fixes to handle multi-line df -k lines better


TABLE=/home/ora9/scripts/diskspace.tab
BOLD=`tput smso`
NORM=`tput rmso`

if [ ! -f $TABLE ]
then TABLE=/home/ora9/scripts/diskspace.tab
echo "Using Table file : "$TABLE
fi

echo "\n\n\n% Used\tWarn\tFilesystem Name\t\t\tCURRENT DISKSPACE STATUS"
echo---"

df -k | while read LINE
do
set x ${LINE}
if [ -n "$3" ] # If $3 is null, suspect multiline fs
then
shift 5
else
read LINE
set x ${LINE}
shift 4
fi

if [ -n "$1" -a "$1" != "used" ]
then
PERCENT=`echo $1 | tr -d '%'`
FILESYSTEM=$2

set x `grep "^${FILESYSTEM} " ${TABLE}` # tab aftr FS
if [ -z "$3" ]
then
continue
fi
MAX=$3
ALARM=$4
if [ -z "$4" ]
then
ALARM=100
fi
if [ ${PERCENT} -gt $MAX ]
then
HDR=${BOLD}
TRL=${NORM}
if [ ${PERCENT} -gt $ALARM ]
then
TRL="$TRL\t\t\t\t*** CRITICAL ***"
else
TRL="$TRL\t\t\t\t*** WARNING ***"
fi
else
HDR=""
TRL=""
fi

echo "${PERCENT}%\t(${MAX}%)\t${HDR}${FILESYSTEM}${TRL}"
fi
done

echo "\n"
exit 0
--------End of DISKSPACE.SH

Any help will be appreciated.

Oracle DBA



Sponsored Link
Ads by Google

Response Number 1
Name: Jim Boothe
Date: July 19, 2005 at 09:06:42 Pacific
Reply:

It works OK on HP-UX.

On that echo on line 70, precede the left and right parentheses with backslashes.


0

Response Number 2
Name: Luke Chi
Date: July 19, 2005 at 09:20:11 Pacific
Reply:

echo "\n\n\n% Used\tWarn\tFilesystem Name\t\t\tCURRENT DISKSPACE STATUS"
echo---" <=== the problem is here

Don't trust copy/paste.

Luke Chi


0

Response Number 3
Name: tunde
Date: July 20, 2005 at 01:45:37 Pacific
Reply:

thanks alot Guys for your help.
I took Luke's advice and commented out the echo----" and it seems to run now.
The problem i have is that its not returning any out put to me.
It reads a file called diskspace.tab with its contents below:
# D I S K S P A C E . T A B
#
# Lookup file for the 'diskspace.sh' program.
# Format: <filesystem> <flag_percent> <alarm_percent>
#
/ 60 80
/opt1% /aixpatch
/orasys1 60 95
/oradat1 95 95
/oraind1 60 95
/arch1 70 95
/stndarch
/redo1 50 95
/redo2 50 95
/orabin1 50 95
/orabin2 60 96
/backup 70 95
/exports 70 95
/oracds 60 90
/orabase 60 90

---------END of DISKSPACE.TAB

Now I know for a fact that the file systems are overused so the script should return the file systems with their usage.
Can you guys please help me to see why this script is not returning any output.
I am new to this and appreciate all your help.
Tony

Oracle DBA


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: error message in script

error message www.computing.net/answers/unix/error-message/4939.html

Error message: bad magic number in disk label www.computing.net/answers/unix/error-message-bad-magic-number-in-disk-label/1166.html

another error message www.computing.net/answers/unix/another-error-message/4940.html