From owner-freebsd-isp Sun Dec 2 16:15:45 2001 Delivered-To: freebsd-isp@freebsd.org Received: from inet03.citec.qld.gov.au (inet03.citec.qld.gov.au [203.5.10.10]) by hub.freebsd.org (Postfix) with ESMTP id 0F75337B405 for ; Sun, 2 Dec 2001 16:15:41 -0800 (PST) Received: by inet03.citec.qld.gov.au; id KAA00571; Mon, 3 Dec 2001 10:15:38 +1000 (EST) Received: from citecub.citec.qld.gov.au( 131.242.4.98) by inet03.citec.qld.gov.au via smap (V2.0) id xma000536; Mon, 3 Dec 01 10:15:36 +1000 Received: from guru.citec.qld.gov.au by citecub.citec.qld.gov.au (SMI-8.6/SMI-SVR4) id KAA29924; Mon, 3 Dec 2001 10:15:35 +1000 Received: from localhost (sgcccdc@localhost) by guru.citec.qld.gov.au (8.9.3/8.9.3) with ESMTP id KAA64642; Mon, 3 Dec 2001 10:15:35 +1000 (EST) (envelope-from sgcccdc@citec.qld.gov.au) X-Authentication-Warning: guru.citec.qld.gov.au: sgcccdc owned process doing -bs Date: Mon, 3 Dec 2001 10:15:34 +1000 (EST) From: Colin Campbell To: "Thomas Krause, CI" Cc: Subject: Re: How to get uptime? In-Reply-To: <5.1.0.14.2.20011202200919.00b1a450@mta.webmatic.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, On Sun, 2 Dec 2001, Thomas Krause, CI wrote: > > Hello, > > ist there an other way to get the system uptime then the "uptime" command? > I need the uptime for a for a script which is called by mrtg. The output > of "uptime" is difficult to parse, eg: > > 8:06PM up 8:47, 1 user, load averages: 0.48, 0.50, 0.42 > 8:05PM up 55 days, 4:35, 1 user, load averages: 0.13, 0.08, 0.02 Depends what you want? For load averages, perl can do this: ($la1, $la5, $la15) = ($_ =~ /(\d+).*ges:\s+(\d+.\d\d), (\d+.\d\d), (\d+.\d\d)/); Where $la* are the load averages. Colin -- Colin Campbell Unix Support/Postmaster/Hostmaster CITEC +61 7 3006 4710 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message