2022-01-10 12:33:06 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# TODO: Verify that variables are set properly
|
2022-01-10 12:46:24 +00:00
|
|
|
|
2022-01-10 12:51:50 +00:00
|
|
|
if [ -z ${PLUGIN_GOTIFY_URL} ]; then
|
|
|
|
echo "PLUGIN_GOTIFY_URL is not set";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z ${PLUGIN_GOTIFY_TOKEN} ]; then
|
|
|
|
echo "PLUGIN_GOTIFY_TOKEN is not set";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-01-10 14:05:05 +00:00
|
|
|
res=$(curl -s "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
|
|
|
|
if [ "$?" -ne "0" ]; then
|
|
|
|
echo "Failed to send message"
|
|
|
|
exit "$?"
|
|
|
|
fi
|
|
|
|
|
2022-01-10 14:07:56 +00:00
|
|
|
echo "Sent message with title \"${PLUGIN_TITLE}\":"
|
2022-01-10 14:05:05 +00:00
|
|
|
echo "${PLUGIN_MESSAGE}"
|