Jeff,

Thanks!!

I sort of got it working, other than it complains with "integer expression
expected" on the "if [ $load -gt $#MY_THRESHOLD ] ; then".  If I comment out
the whole loop and have it send the current CPU level by itself, without
checking MY_THRESHOLD, it works perfectly...  one time only, of course.

Is there a trick to forcing it into treating MY_THRESHOLD as an integer?
Perhaps have to multiply it by 100 to get a full integer, rather than a
decimal value...?  If so... how?  :-)  (yes, I'm a newbie)

Chris



----- Original Message -----
From: "Jeff Kinz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 26, 2003 11:31 AM
Subject: Re: CPU monitoring service => even more Correct


> On Wed, Mar 26, 2003 at 02:25:52PM -0500, Jeff Kinz wrote:
> CORRECTION:
>   mail  -s "$NAME load is at $load"   [EMAIL PROTECTED]
> should be :
>   mail  -n -s "$NAME load is at $load" [EMAIL PROTECTED] <
/dev/null
>
> resulting in.:
>
>
> #The name of the server
> NAME=`hostname`
>
> #  Maximum load you want to allow
> MY_THRESHOLD="0.5"
>
> # of seconds to wait between load checks.
> SECONDS=5
>
> # Loop almost forever.
> while (`true`) ; do
>
> # Replace $1 with which ever field of loadavg you want.
> load=`cat /proc/loadavg | awk '{print $1}'`
>
> if [ $load -gt $#MY_THRESHOLD ] ; then
>   mail  -n -s "$NAME load is at $load" [EMAIL PROTECTED] <
/dev/null
>
> # If we stay in this loop you'll get a TON of emails
> on your cell phone.
> exit
> fi
> sleep $SECONDS
> done
>
>
>
> --
> Jeff Kinz, Open-PC, Emergent Research,  Hudson, MA.  [EMAIL PROTECTED]




-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to