From owner-freebsd-questions Fri Jul 13 11:57:36 2001 Delivered-To: freebsd-questions@freebsd.org Received: from trinity.magpage.com (trinity.magpage.com [216.155.0.8]) by hub.freebsd.org (Postfix) with ESMTP id 8080137B403 for ; Fri, 13 Jul 2001 11:57:32 -0700 (PDT) (envelope-from dfrazier@magpage.com) Received: from magpage.com (dfrazier@poomba.magpage.com [216.155.24.136]) by trinity.magpage.com (8.11.3/8.11.3) with ESMTP id f6DIvUY52590; Fri, 13 Jul 2001 14:57:30 -0400 (EDT) Message-ID: <3B4F4499.1020100@magpage.com> Date: Fri, 13 Jul 2001 14:57:29 -0400 From: Daniel Frazier User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.2) Gecko/20010702 X-Accept-Language: en-us MIME-Version: 1.0 To: Joe Clarke Cc: Graham White , FreeBSD-questions Subject: Re: Newbie Bash-question References: <20010713144955.P25152-100000@shumai.marcuscom.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-RRT-Status: UNKNOWN Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Joe Clarke wrote: > [ expects an integer for both arg 1 and arg 2. .30 is not an integer. > > if [ $LOAD -qt 1 ]; then > > should work for you. IF you need more granularity, you can use Perl. > here's the perl code we use to do this... #!/usr/bin/perl $max_load = 3; $hostname = `uname -n`; chomp $hostname; open (IN, "uptime|"); $line = ; $line =~ /load average: (.*)/; $load_avg = $1; ($l1, $l2, $l3) = split (/\, /, $load_avg); $load = int($l1); if ($load >= $max_load) { open (SENDMAIL, "|/usr/lib/sendmail -t"); print SENDMAIL < Tel: 302-239-5900 Ext. 231 Systems Administrator Fax: 302-239-3909 MAGPAGE, We Power the Internet WWW: http://www.magpage.com/ "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin, Historical Review of Pennsylvania, 1759. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message