LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Uptime shows incorrectly when using hibernate (https://www.linuxquestions.org/questions/slackware-14/uptime-shows-incorrectly-when-using-hibernate-4175467836/)

vdemuth 06-29-2013 12:37 PM

Uptime shows incorrectly when using hibernate
 
I have a server which goes into hibernate overnight when I have no need to use it. I use WOL from my laptop which brings it back up next time I need it.
However, the uptime shows that it has been running currently for 145 days and a few hours, which it can't have been as it's been hibernating.

Anyone got any suggestions as to how I can get the uptime to read correctly?

More of a learning exercise really, so no immediate rush.

Thanks

rworkman 06-29-2013 02:15 PM

Maybe not entirely technically correct, but here's my understanding: as for as your machine is concerned, it *has* been up that entire time - suspend/hibernate are not considered "off" in that regard.

vdemuth 06-30-2013 12:19 AM

Yeah, that is my understanding to. So 'uptime' is not really a fair representation of either the computer activity or indeed an accurate description of itself. More a 'time on power' than an uptime.

Do you know off any utility that will show correctly then the amount of time actually being used as opposed to just being connected to power, a 'serving time' if you will?

Nauntilus 06-30-2013 01:19 AM

This could probably be setup in your system by creating a bash script that logs when the machine is turned on, and when sleep, or hibernate are activated, and log it all to give you the correct up time.

Obviously this would be something you would have to build, but I probably wouldn't be very difficult.

syg00 06-30-2013 02:14 AM

Quote:

Originally Posted by vdemuth (Post 4981028)
So 'uptime' is not really a fair representation of either the computer activity or indeed an accurate description of itself.

Don't be so presumptuous - uptime predated laptops, let alone Linux support of hibernate/suspend.

vdemuth 06-30-2013 02:58 AM

Quote:

Originally Posted by syg00 (Post 4981051)
Don't be so presumptuous - uptime predated laptops, let alone Linux support of hibernate/suspend.


Uptime is a measurement of the time a machine, i.e. computer is available and working. Therefore the very act of placing one into a hibernated state renders it unavailable until it is re-awakened.

The fact that the uptime command may have been available since prior to hibernation doesn't detract from it now being an otherwise incorrectly titled tool and while obviously still valuable for permanently on computers, it fails to give an accurate reflection of the time of a machine that utilises availability on demand.

I'll ignore the insult BTW.

Cheers

syg00 06-30-2013 07:37 AM

If you think that was an insult you have lived a particularly sheltered life.

This being Linux, if you don't like uptime, you are at liberty to amend it to suit your personal proclivities. Submit your updates to LKML - there you will become acquainted with true masters in personal vilification.

eSelix 06-30-2013 11:37 AM

Maybe "uptime" is just incorrect (historical) name for this command. It only show you the difference between your current time and time of machine start which was stored somewhere at boot time. For purpose you want you need a tool which works on backround all the time and just counting seconds. You can probably use information from /proc/timer_list if you have it. For example my system show there a real time when system was running in 3rd row.


All times are GMT -5. The time now is 08:42 AM.