meuter / argon-one-case-ubuntu-20.04

port of the argon one case power button and fan script for Ubuntu 20.04 on rpi 4
255 stars 49 forks source link

constant temperature emitted by tempmon #12

Closed falkben closed 2 years ago

falkben commented 3 years ago

The current temperature is evaluated at install time and inserted into the tempmon script instead of the command to get the current temperature, here: https://github.com/meuter/argon-one-case-ubuntu-20.04/blob/master/argon1.sh#L595

For instance, my script, as installed, looks like:

cat /usr/bin/argonone-tempmon
#! /usr/bin/env bash

while true; do
    date
    echo "47°C"
    sleep 1
    # Go back up two lines.
    echo -ne "\033[2A"
done

instead of what it should be which is

cat /usr/bin/argonone-tempmon
#! /usr/bin/env bash

while true; do
    date
    echo "$(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 ))°C"
    sleep 1
    # Go back up two lines.
    echo -ne "\033[2A"
done
dcomer commented 3 years ago

Seems to me the following should be sufficient for a system script. The reason being is that this script, presumably, would be called in a cron job for logging, and not for the continuous monitor at the console. For continuous monitoring, a second script could be used as you suggested. In either case, I appreciate the work that has been done thus far. Very cool. I use the below (in conjunction with a Python script) to log temperature every hour in a NAS server cluster to tune the NAS temperatures to avoid drive burnout.

! /usr/bin/env bash

echo "$(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 ))°C"