Date: Tue, 14 Jun 2011 09:11:06 -0400 From: jhell <jhell@DataIX.net> To: John <jwd@slowblink.com> Cc: freebsd-rc@freebsd.org Subject: Re: Downtime report rc script? Message-ID: <20110614131105.GA27199@DataIX.net> In-Reply-To: <20110614032343.GA96959@FreeBSD.org> References: <20110614032343.GA96959@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 14, 2011 at 03:23:43AM +0000, John wrote: >=20 > Hi Folks, >=20 > I'm trying to put together a simple to report at boot time how > long the system was down. >=20 > The 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. >=20 > Am I missing something simple? I've thought about writing a simple > 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. >=20 > Thoughts? >=20 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. --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJN913pAAoJEJBXh4mJ2FR+8yUH/3zUpW+6eGlCMOuq+mBEZH3m 360+sIbKNzfABHjz8ZmwzJQHBrMOBqiprqK2G5+GnMGbIEVNozsHJSi4EO9CgNgn asu8CFnBab9DCNwepHsFd11LBv2S6M5kkehknx0a6FQjdVE8m38QibbUOaMaKAAx 3YtVNRkdCU38E9ioz3N538s/7mjgQBFO0hGs3PZV+3m1Gd4BoNVNWDXNp7RTiE8P TKjRh87RdUBT25BamSrSkl+za6SQKTi0jTLepRKBDyk2KUK4esJhDRu2bD3Qi3Lr uVXhk0wKWLMl+cRVgVOruytkG+f/6A9OuhEZkRDOYwylY6y8VzIIwCsdQy+wqxc= =PLZg -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110614131105.GA27199>