Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux uptime history

Tags:

linux

How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.

Update: Not sure if it is based on a length of time or if last gets reset on reboot but I only get the most recent boot timestamp with the last command. last -x also does not return any further info. Sounds like a script is my best bet.

Update: Uptimed is the information I am looking for, not sure how to grep that info in code. Managing my own script for a db sounds like the best fit for an application.

like image 718
Jas Avatar asked Sep 17 '08 02:09

Jas


People also ask

How do you check uptime history?

To check the uptime of a PC go to Terminal and type uptime then press enter. screenfetch also works for this and provides data in a nice way. Install it with $ sudo apt install screenfetch . Then type screenfetch for the information.

How do you check when was Linux last rebooted?

The best way to check the last reboot time in Linux is using the last reboot command. Open the terminal and type last reboot. It will show all reboots since the log file was created. To list the last reboot time, run last reboot| head -2.

How do I see uptime in Linux?

First, open the terminal window and then type: uptime command – Tell how long the Linux system has been running. w command – Show who is logged on and what they are doing including the uptime of a Linux box. top command – Display Linux server processes and display system Uptime in Linux too.

How can I tell why my computer rebooted Linux?

Use who command to find last system reboot time/date The pseudo user reboot logs in each time the system is rebooted. Thus last reboot command will show a log of all reboots since the log file was created.


1 Answers

Install uptimed. It does exactly what you want.

Edit:

You can apparantly include it in a PHP page as easily as this:

<? system("/usr/local/bin/uprecords -a -B"); ?> 

Examples

like image 177
1800 INFORMATION Avatar answered Oct 11 '22 23:10

1800 INFORMATION