have a look at script i want to add multiple error in "ALERT" Variable but getting error nor getting required result.when im writing only one error then script is running successfully.Kindly suggest me how i add multiple error in this script as i can get required result.
For single hard code error like ALERT="ORA-00060" it working perfect.
Thanks in advance.
#!/bin/sh
#GLOBS
ALERT="ORA-00060","TNS","crash","Error",'abort","cannot allocate","not complete","waiting","All online" ;
LOGFILE=/path/to/my/alert_X.log
MYFILE=/home/user/test.log
##
#get the errors out of the logfile.
grep -h "$ALERT" $LOGFILE >> $MYFILE
#count number of lines in myfile, and print.
VAR=`wc -l $MYFILE | awk -F" " '{print $1}'`
#echo $VAR
# if the amount of lines is greater than 0, then cat the file and send it to me. if not then echo all clear.
#size variable is the number of errors the last time the script ran
size=`wc -l test.last | awk -F" " '{print $1}'`
echo $size
# if the amount of lines is greater than 0, then cat the file and send it to me. if not then echo all clear
if [[ $VAR -gt $size ]] ; then
cat $MYFILE | mail -vs "oralert"
user@domain.com ;
else
echo "All clear.."
fi;
rm test.last
mv test.log test.last