Hi,
I have written a shell script for oracle on unix that does a df for specific files, and then will display the size, Avail, % used and the difference from yesterday to today.
I have been asked to place it on some MySql databases that run onn unix and linux also, but when I try to run them I am getting some bizar errors. Not knowing anything about MySql, I am in need of some help.
Here is a portion of the script and the errors I get just for those lines. Help please, or even if you can recommend a book that deals with shell scripting on mysql?
set F_SYSTEMS= ( /mysql )
set OUTFILE=${WORK_DIR}/files.out
set TMPFILE=${WORK_DIR}/temp
set WRKFILE=${WORK_DIR}/files.txt
set ARCHFILE=${WORK_DIR}/fs_yesterday.out
#*********************************************************************
#* Loop through the list of partitions
#*********************************************************************
printf '%12s %79s\n' "(KB)" "DAY TO DAY">> ${OUTFILE}
printf '%12s %11s %11s %6s %-34s %10s\n' "SIZE" "USED" "AVAIL" "%USED" "MOUNTED" "DELTA">> ${OUTFILE}
foreach PARTITION (${F_SYSTEMS})
df -k ${PARTITION} > ${WRKFILE}
grep -v Filesystem ${WRKFILE} | grep % | tr -s "" " " | sed -e 's/^ //g' | sed -e 's/^ //g' > ${TMPFILE}
if (`cut -c1 ${TMPFILE}` == '/') then
set SIZ=`cut -d" " -f2 ${TMPFILE}`
set USD=`cut -d" " -f3 ${TMPFILE}`
set AVAIL=`cut -d" " -f4 ${TMPFILE}`
set PCT=`cut -d" " -f5 ${TMPFILE} | sed -e 's/%//'`
set MNTD=`cut -d" " -f6 ${TMPFILE}`
else
: ./my.csh
./my.csh: line 21: syntax error near unexpected token `('
./my.csh: line 21: `set F_SYSTEMS=( /mysql )'
./my.csh: line 32: $OUTFILE: ambiguous redirect
./my.csh: line 33: ${OUTFILE}: ambiguous redirect
./my.csh: line 35: syntax error near unexpected token `('
./my.csh: line 35: `foreach PARTITION (${F_SYSTEMS})'
./my.csh: line 35: foreach: command not found
Does anyone have a clue what these errors are wanting?
I have tried going through and changing, for example, set F_SYSTEMS=( /mysql ) to F_SYSTEMS= /mysql
and $(OUTFILE) to OUTFILE
but when it tells me that 'foreach: command not found' I am stymied as to what to do nex.
Any help will be greatly appreciated,
thanks,