[SOLVED] How can I tell how many hours a computer has been running in its life?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I tell how many hours a computer has been running in its life?
I would like to be able to tell how much time my computers have spent running. I am not interested in how long they have run before needing to be rebooted—I tend to rotate from job to job, and they all spend more time shut down than running.
I realize that this raises the philosophical question, "What is a computer?". CPU, motherboard, HDD? It would be easy to treat a tower as a kind of "grandfather's axe—a new head, and three new handles, and as good as the day it was made". Looking online, it seemed that an easy measure would be the total number of hours the HDD had been running.
I also see that this information would be unlikely to be very useful as a predictor of how much longer a computer might last. . .
I am running Linux Mint Cinnamon 17.3, and looked at the Disk Usage Analyzer, which didn't seem to offer that information. Is there a command? And if so, would it give a global total, or only a total for the usage under the current distribution?
uptime is reset at boot so you need something like uptimed to track totals. This would only provide data since OS instalation. I have never seen any BIOS hour meter in a desktop PC which is why using HDD data is the next best approximation.
I agree with michaelk that the use of 'hdparm' would be a good indicator for the system drive to show the hours for a System overall. That would be if that HDD was the original system drive.
Quote:
From 'man hdparm';
hdparm - get/set SATA/IDE device parameters
SYNOPSIS
hdparm [options] [device ...]
DESCRIPTION
hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older
IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore
may also work with hdparm. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with
the latest kernels.
Some advanced bios makers might have logs for some clues. Some of the lights out boards might have logs. Unfortunately they can be cleared.
Someone said NASA bought 1000 of this special built computer for use on a mission. I asked the manager why would they buy 1000. He said that the computer maker tested them but NASA would put the most demanding tests. After many of them failed they'd select from the remaining ones assuming that they have a great chance of working. So, a computer that has been running longer may in fact be better.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Simple matter of sripting, isn't it? (and some kinda-related trivia)
(Argh! Make that "scripting".)
If the system is brand new, you can keep track of the uptime and accumulate that with some scripting that runs at startup and shutdown. However, accounting for uptime that ends in a kernel panic or a power failure won't be as easy. You'd need to run a task that updates a system uptime accumulator every minute in, say, a cron job and use that to update an overall uptime accumulator stashed in a file somewhere.
Trivia: Many "large" computer systems used to have a actual "Hobbs meter" (you GA pilots will know what this is) will that recorded how long the system had been powered up and these would be rare on a system that wasn't installed in multiple 19" racks. I never asked the field service guys what they used this for. I assume it gave them an idea as to when certain preventive maintenance activities should be scheduled.
Last edited by rnturn; 10-18-2016 at 07:33 AM.
Reason: Can't type this morning
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.