From f14a13d40a0d48e6f90d6c55c16a5139b08c7745 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Sat, 6 Sep 2025 15:52:51 +0100 Subject: [PATCH] Dodanie skryptow temperature sms-alert. --- send-temperature-alert | 13 +++++++++++++ temperature-watchdog | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100755 send-temperature-alert create mode 100755 temperature-watchdog diff --git a/send-temperature-alert b/send-temperature-alert new file mode 100755 index 0000000..1eadc0a --- /dev/null +++ b/send-temperature-alert @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ -f /tmp/temp.txt ]; then + sudo rm /tmp/temp.txt; +fi + +echo -e "Uwaga! W serwerownii temperatura powietrza wynosi: \ +$(echo "$(cat /sys/bus/w1/devices/28-0316850291ff/temperature) / 1000" \ +| bc -l \ +| cut -c 1-6) oC.\nTa wiadomosc zostala wygenerowana automatycznie prosze na nia nie odpowiadac." | sudo tee /tmp/temp.txt > /dev/null 2>&1; + +RECV="" +sudo mmcli -s $(basename $(sudo mmcli -m 0 --messaging-create-sms="number=\"${RECV}\"" --messaging-create-sms-with-data=/tmp/temp.txt | cut -d ":" -f 2)) --send; diff --git a/temperature-watchdog b/temperature-watchdog new file mode 100755 index 0000000..ace03aa --- /dev/null +++ b/temperature-watchdog @@ -0,0 +1,8 @@ +#!/bin/bash + +MAX_TEMP= + +currentTemp=$(cat /sys/bus/w1/devices/28-0316850291ff/temperature); +if [ $currentTemp -ge $MAX_TEMP ]; then + /usr/local/bin/send-temperature-alert > /dev/null 2>&1; +fi -- 2.39.5