discord and thermal (pi specific) added, discord needs config setup.

This commit is contained in:
2020-04-16 19:46:53 +00:00
parent e90da400c7
commit 60b8c70f3f
4 changed files with 37 additions and 0 deletions
+1
View File
@@ -1 +1,2 @@
/log/singleton.log
/config.sh
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
DISCORD_GENERAL_HOOK="<WEBHOOK_URL_HERE>"
DISCORD_THERMAL_HOOK="<WEBHOOK_URL_HERE>"
DISCORD_STORAGE_HOOK="<WEBHOOK_URL_HERE>"
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
source config.sh
HOOK_ARG="$1"
MESSAGE="${@:2}"
HOOK="general"
HOOK_URL=$DISCORD_GENERAL_HOOK
case $HOOK_ARG in
thermal)
HOOK="thermal"
HOOK_URL=$DISCORD_THERMAL_HOOK
;;
storage)
HOOK="storage"
HOOK_URL=$DISCORD_STORAGE_HOOK
;;
esac
curl -s -H "Content-Type: application/json" -X POST -d "{\"content\": \"${MESSAGE}\"}" $HOOK_URL | jq -r '.id'
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
name=$(</sys/class/thermal/thermal_zone0/type)
temp=$(</sys/class/thermal/thermal_zone0/temp)
echo "${name} $((temp/1000)).$((temp%1000))c"