Remotely (re)starting my system via a smart power switch?
Bo Berglund
bo.berglund at gmail.com
Sun Jul 24 20:40:23 UTC 2022
On Sun, 24 Jul 2022 13:28:49 +0100, ubuntu at howorth.org.uk wrote:
>> I will then probably add a cron job to log the temperature of the CPU
>> every minute or so such that I can view it after the laptop has shut
>> down. (Logging to a network drive).
>>
>> Is there a simple command I can use in the log script to remove lines
>> older than say an hour from the log file when I add a new entry?
>> Or keep only the last 60 lines or so in the file.
>
>You could set up munin or something similar.
Well, I don't know munin but I think something like this will do using bash:
cd ~/log
date "+%F %T" >> templog.log # Save timestamp in file
sensors | grep "Core 0:" >> templog.log # Produces 1 log line
tail -n 50 templog.log > templog2.log # Save last 25 checks
mv templog2.log templog.log # Overwrite logfile with pruned version
If a crash occurs the logfile will show the temp at crash time.
Of course I will have to check that the logfile is not overwritten at wakeup...
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list