Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jun 2011 15:12:34 +0100
From:      Chris Rees <utisoft@gmail.com>
To:        jhell <jhell@dataix.net>
Cc:        freebsd-rc@freebsd.org, John <jwd@slowblink.com>
Subject:   Re: Downtime report rc script?
Message-ID:  <BANLkTi=C_hW7iYCDb9wci4SNtV%2BZ0JAZpg@mail.gmail.com>
In-Reply-To: <20110614131105.GA27199@DataIX.net>
References:  <20110614032343.GA96959@FreeBSD.org> <20110614131105.GA27199@DataIX.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 14 June 2011 14:11, jhell <jhell@dataix.net> wrote:
> On Tue, Jun 14, 2011 at 03:23:43AM +0000, John wrote:
>>
>> Hi Folks,
>>
>> =A0 =A0I'm trying to put together a simple to report at boot time how
>> long the system was down.
>>
>> =A0 =A0The script itself isn't really a problem, but I'm coming up short
>> looking for a reliable way to determine exactly when the sytem
>> went down regardless of whether it was a clean reboot or a crash.
>>
>> =A0 =A0Am I missing something simple? I've thought about writing a simpl=
e
>> little program to touch a file once per second invoked by the downtime
>> rc script after querying the last time the file was touched... but
>> there must be a simpler solution.
>>
>> =A0 =A0Thoughts?
>>
>
> Record the system bootup time, and then every 5 minutes or so the
> current time with each new record replacing the last. In the shutdown,
> record the current time that replaces the last recorded current time, so
> it will give you the actual time the machine was going down as close as
> possible. Get these two/three things together then you got a fairly
> close/accurate way to determine how long the system is down when it
> comes back up. I would suggest using (date -u).
>
> sysutils/uptimed has some internal routines for calculating this. you
> might want to also take a look at that.
>

Also, the Uptimes Project [1], this one showing my old server before I
finally retired it.

Chris

[1] http://uptimes-project.org/hosts/view/2288



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTi=C_hW7iYCDb9wci4SNtV%2BZ0JAZpg>