made thermal.sh command have the zone be configurable.

This commit is contained in:
2022-02-17 16:26:34 +00:00
parent 6807764242
commit df4fc168f5
2 changed files with 10 additions and 3 deletions
+4 -1
View File
@@ -1,8 +1,11 @@
!/bin/bash
#!/bin/bash
# degrees in C
THERMAL_ALERT=75
# see: /sys/class/thermal/thermal_zone*
THERMAL_ZONE=0
STORAGE_MONITOR=("/")
# must declare associated array explicitly
+6 -2
View File
@@ -1,10 +1,14 @@
#!/bin/bash
LOCATION=`dirname "$0"`
source "${LOCATION}/config.sh"
# this is currently specific to raspberry-pi
# since that is the only kind of physical server I have
# TODO make this work with all temp in class/thermal
name=$(</sys/class/thermal/thermal_zone0/type)
mc=$(</sys/class/thermal/thermal_zone0/temp)
name=$(</sys/class/thermal/thermal_zone${THERMAL_ZONE}/type)
mc=$(</sys/class/thermal/thermal_zone${THERMAL_ZONE}/temp)
c=`echo "scale=1 ; $mc / 1000.0" | bc -l`
f=`echo "scale=1 ; $c * 9 / 5 + 32" | bc -l`