updated thermal cron scripts to format output better
This commit is contained in:
@@ -22,12 +22,12 @@ alert="$?"
|
||||
if [[ '0' -ne "${alert}" ]]; then
|
||||
# if currently in an alert status
|
||||
alertLevelF=$(echo "scale=1 ; ${alertLevel} * 9 / 5 + 32" | bc -l)
|
||||
ntfy pub -T red_square -t "Thermal alert on $hostname" thermal "${thermal}" $'\n' "above threshold ${alertLevel} C (${alertLevelF} F)"
|
||||
echo "${thermal}" $'\n' "above threshold ${alertLevel} C (${alertLevelF} F)" | ntfy pub -T red_square -t "Thermal alert on $hostname" thermal
|
||||
touch "${HOME}/.thermal.alert"
|
||||
elif [[ -f "${HOME}/.thermal.alert" ]]; then
|
||||
# if previously in an alert status
|
||||
alertLevelF=$(echo "scale=1 ; ${alertLevel} * 9 / 5 + 32" | bc -l)
|
||||
ntfy pub -T orange_square -t "Thermal alert on $hostname" thermal "${thermal}" $'\n' "previously above threshold ${alertLevel} C (${alertLevelF} F)"
|
||||
echo "${thermal}" $'\n' "previously above threshold ${alertLevel} C (${alertLevelF} F)" | ntfy pub -T orange_square -t "Thermal alert on $hostname" thermal
|
||||
rm "${HOME}/.thermal.alert"
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@ hostname=$(hostname)
|
||||
thermal=$(${scriptRoot}/thermal.sh)
|
||||
|
||||
if [[ -n "$thermal" ]]; then
|
||||
ntfy pub -T yellow_square -t "Thermal status on $hostname" thermal
|
||||
echo "$thermal" | ntfy pub -T yellow_square -t "Thermal status on $hostname" thermal
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user