thermal scripts updated, crons only poll temp once, etc.

This commit is contained in:
2020-04-22 19:17:04 +00:00
parent b6fcb3c36b
commit f487f6e391
4 changed files with 23 additions and 9 deletions
+1
View File
@@ -1,2 +1,3 @@
/log/singleton.log
/config.sh
/crons/*.status
+12 -6
View File
@@ -4,12 +4,18 @@ LOCATION=`dirname "$0"`
source "${LOCATION}/../config.sh"
if (( `cat /sys/class/thermal/thermal_zone0/temp` > ( $THERMAL_ALERT * 1000 ) )); then
echo "thermal above ${THERMAL_ALERT} C"
source "${LOCATION}/../thermal.sh"
${LOCATION}/../discord.sh thermal `${LOCATION}/../thermal.sh`
thermal=`${LOCATION}/../thermal.sh ${THERMAL_ALERT}`
alert=$?
if [[ "0" != "${alert}" ]]; then
echo "${thermal}, above threshold ${THERMAL_ALERT} C"
${LOCATION}/../discord.sh thermal "${thermal}, above threshold ${THERMAL_ALERT} C"
touch "${LOCATION}/thermal.status"
elif [[ -f "${LOCATION}/thermal.status" ]]; then
rm "${LOCATION}/thermal.status"
echo "${thermal}, previously above threshold ${THERMAL_ALERT} C"
${LOCATION}/../discord.sh thermal "${thermal}, previously above threshold ${THERMAL_ALERT} C"
else
echo "thermal below ${THERMAL_ALERT} C"
source "${LOCATION}/../thermal.sh"
echo "${thermal}, below threshold ${THERMAL_ALERT} C"
fi
+4 -2
View File
@@ -2,6 +2,8 @@
LOCATION=`dirname "$0"`
source "${LOCATION}/../thermal.sh"
${LOCATION}/../discord.sh thermal `${LOCATION}/../thermal.sh`
thermal=`${LOCATION}/../thermal.sh`
echo "${thermal}"
${LOCATION}/../discord.sh thermal "${thermal}"
+6 -1
View File
@@ -2,5 +2,10 @@
name=$(</sys/class/thermal/thermal_zone0/type)
temp=$(</sys/class/thermal/thermal_zone0/temp)
echo "${name}: $((temp/1000)).$((temp%1000)) C"
temp="$((temp/1000)).$((temp/100%10))"
echo "${name}: ${temp} C"
if (( "$#" > "0" )); then
exit `echo "$temp >= $1" | bc`
fi