From 60b8c70f3f384d06079d33b581b5d363bc5921dd Mon Sep 17 00:00:00 2001 From: Andrew Stowell Date: Thu, 16 Apr 2020 19:46:53 +0000 Subject: [PATCH] discord and thermal (pi specific) added, discord needs config setup. --- .gitignore | 1 + config.example.sh | 8 ++++++++ discord.sh | 22 ++++++++++++++++++++++ thermal.sh | 6 ++++++ 4 files changed, 37 insertions(+) create mode 100644 config.example.sh create mode 100755 discord.sh create mode 100755 thermal.sh diff --git a/.gitignore b/.gitignore index cf1b7ef..0fe6ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /log/singleton.log +/config.sh diff --git a/config.example.sh b/config.example.sh new file mode 100644 index 0000000..01b45c3 --- /dev/null +++ b/config.example.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DISCORD_GENERAL_HOOK="" + +DISCORD_THERMAL_HOOK="" + +DISCORD_STORAGE_HOOK="" + diff --git a/discord.sh b/discord.sh new file mode 100755 index 0000000..42d1f58 --- /dev/null +++ b/discord.sh @@ -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' + diff --git a/thermal.sh b/thermal.sh new file mode 100755 index 0000000..f71e188 --- /dev/null +++ b/thermal.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +name=$(