]> gitweb.morketsmerke.org Git - backup.git/commitdiff
Dodanie skryptow temperature sms-alert.
authorxf0r3m <jakubstasinski@protonmail.com>
Sat, 6 Sep 2025 14:52:51 +0000 (15:52 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Sat, 6 Sep 2025 14:52:51 +0000 (15:52 +0100)
send-temperature-alert [new file with mode: 0755]
temperature-watchdog [new file with mode: 0755]

diff --git a/send-temperature-alert b/send-temperature-alert
new file mode 100755 (executable)
index 0000000..1eadc0a
--- /dev/null
@@ -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 (executable)
index 0000000..ace03aa
--- /dev/null
@@ -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