From owner-freebsd-questions Wed Aug 14 7:32:51 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 87AA337B400 for ; Wed, 14 Aug 2002 07:32:48 -0700 (PDT) Received: from mail.seekingfire.com (coyote.seekingfire.com [24.72.10.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07C0043E6A for ; Wed, 14 Aug 2002 07:32:48 -0700 (PDT) (envelope-from tillman@seekingfire.com) Received: from blues.seekingfire.prv (blues.seekingfire.prv [192.168.23.211]) by mail.seekingfire.com (Postfix) with ESMTP id 8DA9C1A4 for ; Wed, 14 Aug 2002 08:32:47 -0600 (CST) Received: (from tillman@localhost) by blues.seekingfire.prv (8.11.6/8.11.6) id g7EEWrr12027 for freebsd-questions@freebsd.org; Wed, 14 Aug 2002 08:32:53 -0600 Date: Wed, 14 Aug 2002 08:32:53 -0600 From: Tillman Hodgson To: freebsd-questions@freebsd.org Subject: Extracting the 1-minute loadavg in a portable yet low-impact fashion Message-ID: <20020814083253.C11913@seekingfire.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-Urban-Legend: There is lots of hidden information in headers 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 Howdy, I'm trying to extract the 1-minute loadavg in a portable (between RedHat Linux and FreeBSD, at least) way without having to invoke a lot of expensive subprocesses. On Linux, awk '{print \$1}' < /proc/loadavg has been working nicely (though non-portably). When I log onto a BSD host and my NFS-mounted home dir follows me, this obviously doesn't work very well :-) uptime | awk '{print $10}' works, but leaves a trailing comma. Adding a sed statement to the end of that would start to get too expensive. sysctl vm.loadavg | awk '{print $3}' works on FreeBSD, but isn't portable back to Linux. Anything else that simple and inexpensive that I'm missing? TIA, - Tillman -- Never appeal to a man's "better nature." He may not have one. Invoking his self-interest gives you more leverage. Robert Heinlein To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message