1847017 Members
5002 Online
110258 Solutions
New Discussion

Re: script

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

script

Hi,

I have a script name test.sh

It checks for the extents of Informix Database that are more then or equal to 100 and sends a warning message to me.

As per this script if there are two or more tables having more then 100 then it sends two or more mails.

I want it to send only one mail even if there are more then one tables more then 100.

How can it be done?
Script attached.

Thanks,
Raje.

Everything is possible
2 REPLIES 2
Steve Steel
Honored Contributor
Solution

Re: script

Hi


Select a filename for your mail.

Remove it at the start of the script.

When the 100 limit is breached write your data to the file mentioned above


At the end of the script

if [ -f file ]
then
elm -s xxxxxxxxxxxxx < file
/bin/rm file
fi

steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Nick Wickens
Respected Contributor

Re: script

My solution would be a variable and loop - ie

MAIL=NO
while true
do
if [ $MAIL -eq "NO" ]
then
if [ "extent check positive ?" ]
then
MAIL=YES
"sendmail commands"
exit
fi
fi
done

So basically as soon as you find one extent over or equal to 100 then send the mail and set the MAIL variable to YES which would then exit the loop.
Hats ? We don't need no stinkin' hats !!