0

I am aware that there are other questions asking very similar questions, but none seems to answer my problem. I am running an odroid hc2 sbc with armbian for a nextcloud instance. Two days ago, it crashed, for the first time, after running stable for over a year. To rule out overheating as a reason, I'd like to write a script to monitor temperature, i.e. running the built in function "armbianmonitor", which creates this continous output:

Stop monitoring using [ctrl]-[c]
Time       big.LITTLE   load %cpu %sys %usr %nice %io %irq   CPU  C.St.

09:52:33:  600/ 600MHz  0.23  12%   1%  10%   0%   0%   0% 53.0°C  0/13
09:52:38: 1400/ 600MHz  0.21   2%   0%   1%   0%   0%   0% 53.0°C  0/13
09:52:43: 1400/ 600MHz  0.20   2%   0%   1%   0%   0%   0% 53.0°C  0/13^C

with:

sudo armbianmonitor -m | awk '$11 ~ "°C" {print $1; print $1;exit1}' ORS=' '

I get this results:

09:57:48: 53.0°C 09:57:53: 51.0°C 09:57:58: 51.0°C 09:58:03: 51.0°C 

but... I'd like to have only one pair (time and temperature) per run of the script. In other word, awk and /or (?) armbianmonitor are supposed to stop after they return the first pair. I've also tried to pipe the output of a script invoking this command to a file, but the file remains blank, maybe because armbianmonitor creates a continuous output?

0

I took a slightly different path and now do the following:

executed every minute:

#!/bin/bash

dttm=$(date +"%d.%m.%Y %H:%M;")
temp=$(echo $(cat /sys/devices/virtual/thermal/thermal_zone0/temp) /1000 | bc)

echo $dttm $temp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.