topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday October 15, 2024, 3:00 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: accurate log file of uptime - even if power turned off  (Read 4805 times)

Steven Avery

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,038
    • View Profile
    • Donate to Member
accurate log file of uptime - even if power turned off
« on: April 03, 2009, 02:52 PM »
Hi Folks,

  Most up-time measurement tools are for screen display, or for a network monitoring.  If you try to measure uptime on a local puter and put the info to a log file you have the problem of a BSOD or power-off that is a disorderly shutdown of the program.   They will have a start time but no end time, thus no total time.

  Thus one design would be to have a polling and update the end time every interval (e.g. a minute) and update the end time so that even in a power off .. the info is there -- "The puter was up from 12:00 to 5:00".  It would be nice if the report knew whether a Windows orderly shutdown was in process at the final polling, and marked the distinction, however that is a nicety. 

  An alternative would be to have the polling done by another puter on the network (e.g. a home computer shared behind the router) which presumably is on 24/7.

   My puter that is having the BSOD would use this, I would like to know how long it stays up (it can BSOD even when nothing is apparently happening, or it can stay happy through hard work).

   Do you know anything that exists for an accurate log of uptime -- that works even if the power is turned off ?

   If the log includes other information about activity, so much the better, however I am wondering if there is a program that covers the simple thing first.

Shalom,
Steven Avery

 

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: accurate log file of uptime - even if power turned off
« Reply #1 on: April 03, 2009, 04:34 PM »
You could probably use any launcher that has a periodic launch capability.
A simple .cmd batch file should be all you need.
Something like:
echo %date%  %time% >KillTime.txt

every time the batch runs it would overwrite KillTime.txt with the last
date & time.

Also it might be a good idea to flush the hard drive buffers so that the file
gets written after each iteration.  The free sync.exe from Sysinternals.com
should do it.  After the echo line just add the line sync.exe.  It just locks the
drive to force all write buffers to be flushed to the hardware.

« Last Edit: April 03, 2009, 04:35 PM by MilesAhead »

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: accurate log file of uptime - even if power turned off
« Reply #2 on: April 03, 2009, 05:20 PM »
or change ">KillTime.txt" to ">>KillTime.txt" so you append the date/time to the file

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: accurate log file of uptime - even if power turned off
« Reply #3 on: April 03, 2009, 06:59 PM »
Providing you don't clear out your Event Log too often then use the handy-dandy Uptime command from your friends at Microsoft :)

uptime /s will give you all the time/date of all boots/shutdowns, Total Reboots, Meantime Between Reboots, Total BSODs, System Availability, lots of other things plus Total Uptime since the start of the log.

And it will work across a network.

Use uptime /help for more info on what it can and can't do, especially the heartbeat function which may suffice for what you require.

UPTIME, Version 1.01
(C) Copyright 1999, Microsoft Corporation

Uptime [server] [/s ] [/a] [/d:mm/dd/yyyy | /p:n] [/heartbeat] [/? | /help]
        server          Name or IP address of remote server to process.
        /s              Display key system events and statistics.
        /a              Display application failure events (assumes /s).
        /d:             Only calculate for events after mm/dd/yyyy.
        /p:             Only calculate for events in the previous n days.
        /heartbeat      Turn on/off the system's heartbeat
        /?              Basic usage.
        /help           Additional usage information.
« Last Edit: April 03, 2009, 07:50 PM by 4wd »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: accurate log file of uptime - even if power turned off
« Reply #4 on: April 03, 2009, 07:20 PM »
or change ">KillTime.txt" to ">>KillTime.txt" so you append the date/time to the file

I don't see the advantage.  The last one is the only one that matters.  Also overwriting keeps the file small.