From 1bf404181e25a92144c133a0fb525c9d054759cf Mon Sep 17 00:00:00 2001 From: Andrew Stowell Date: Thu, 16 Apr 2020 20:39:10 +0000 Subject: [PATCH] new thermal-alert crontab script. --- config.example.sh | 3 +++ crons/thermal-alert.sh | 15 +++++++++++++++ thermal.sh | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 crons/thermal-alert.sh diff --git a/config.example.sh b/config.example.sh index 23f5ecf..741f27d 100644 --- a/config.example.sh +++ b/config.example.sh @@ -1,5 +1,8 @@ !/bin/bash +# degrees in C +THERMAL_ALERT=75 + DISCORD_SERVER_NAME="" DISCORD_GENERAL_HOOK="" diff --git a/crons/thermal-alert.sh b/crons/thermal-alert.sh new file mode 100755 index 0000000..d626689 --- /dev/null +++ b/crons/thermal-alert.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +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` +else + echo "thermal below ${THERMAL_ALERT} C" + source "${LOCATION}/../thermal.sh" +fi + diff --git a/thermal.sh b/thermal.sh index f71e188..5236be7 100755 --- a/thermal.sh +++ b/thermal.sh @@ -2,5 +2,5 @@ name=$(