System running time since first boot
I want to know to how many hours or days or months my system has been run since the day I installed it.
I know uptime gives the info of current system running time from the boot . But I want the total runtime of system regardless of how many time I boot or reboot.. Thanks in Advance |
I dunno of any way to find out afterwards but you could have a script that runs when you shutdown the machine that print the output of uptime and sums it up with previous values from a file.
|
I have the same thought but don't know much about scripting.. Please help me a little with some dummy script. I will take care of it further..
|
Code:
NEW=$(uptime | awk '{print $3" "$4" " $5}') # gives the days and hours of uptime Or create a cronjob that runs every 5 Minutes and adds 5 Minutes to a file. This way you'll survive serious outtakes where the machine has to be hard reseted or core dumps. |
Thanks a lot ..I will go with 5 min cron job..
|
All times are GMT -5. The time now is 03:59 AM. |