3ffde7807f3a6df3c402a96de24dd531c0488ed6

Author
thel0be <sean@burrowes.me>
Committer
thel0be <sean@burrowes.me>
Date

Message

Adding Pushover notifications

Diff

 1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
 2index 5ac28fdda698ea69889e56a03e53cb4e12cf1f31..9aaccd6a1b2ec1d22697bbeb8369b3c1c6fad0f6 100644
 3--- a/duplicity-backup.conf.example
 4+++ b/duplicity-backup.conf.example
 5@@ -418,6 +418,9 @@ SLACK_CHANNEL="#general"
 6 SLACK_USERNAME="duplicity-backup"
 7 SLACK_EMOJI="package"
 8 
 9+# Provider: Pushover
10+PUSHOVER_TOKEN="token" # App token generated at pushover.net
11+PUSHOVER_USER="userkey" # User key from pushover.net
12 
13 # ------------------------------------------------------------------------------
14 # TROUBLESHOOTING
15diff --git a/duplicity-backup.sh b/duplicity-backup.sh
16index 2782e69235844bc2caee07b6cdd0073e28210cce..4855828f8b721d05a2268fb04f7de3c18d21cf93 100755
17--- a/duplicity-backup.sh
18+++ b/duplicity-backup.sh
19@@ -410,8 +410,14 @@ send_notification()
20   if [ ! -z "${NOTIFICATION_SERVICE}" ]; then
21     if [ "${NOTIFICATION_SERVICE}" = "slack" ]; then
22       curl -X POST -H 'Content-type: application/json' --data "{\"text\": \"${NOTIFICATION_CONTENT}\", \"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_USERNAME}\", \"icon_emoji\": \":${SLACK_EMOJI}:\"}" "${SLACK_HOOK_URL}"
23-
24       echo -e "Slack notification sent to channel ${SLACK_CHANNEL}" >> "${LOGFILE}"
25+    elif [ "${NOTIFICATION_SERVICE}" = "pushover" ]; then
26+      curl -s \
27+      -F "token=APP_TOKEN" \
28+      -F "user=USER_KEY" \
29+      -F "message=${NOTIFICATION_CONTENT}" \
30+      https://api.pushover.net/1/messages
31+      echo -e "Pushover notification sent" >> "${LOGFILE}"
32     fi
33   fi
34 }