I need to log PC uptime. How I can do this?
uptime for this and I will when ubuntu is shutdown write this command output in a file.
If you are using Ubuntu
then add below lines in "/etc/rc0.d/S60umountroot" at the beginning.
or you can simply use
then it will gives details in
Note :- Please careful edit this file
If you are using CentOs, then do the same in "/etc/rc.d/rc0.d/S01halt", but note that it should be added in beginning of the file.
If you need to track the system uptime behavior, try tuptime It report the historical and statistical running time of the system, keeping it between each reboot.