Artificial intelligent assistant

write pc uptime in a file in shutdown I need to log PC uptime. How I can do this? I use `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.


Log="/var/log/uptime.log"
echo "$(date) $(/usr/bin/uptime)" >> "${Log}"


or you can simply use `logger`


logger "UPTIME: $(uptime)"


then it will gives details in `/var/log/syslog` or `/var/log/messages`

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.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8843b4e8cef524a09fa5b3c892bd2d43