Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2001 10:15:34 +1000 (EST)
From:      Colin Campbell <sgcccdc@citec.qld.gov.au>
To:        "Thomas Krause, CI" <freebsd@chef-ingenieur.de>
Cc:        <freebsd-isp@FreeBSD.ORG>
Subject:   Re: How to get uptime?
Message-ID:  <Pine.BSF.4.33.0112031014050.64334-100000@guru.citec.qld.gov.au>
In-Reply-To: <5.1.0.14.2.20011202200919.00b1a450@mta.webmatic.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0112031014050.64334-100000>