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.
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With