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=$(