From 3ffde7807f3a6df3c402a96de24dd531c0488ed6 Mon Sep 17 00:00:00 2001 From: thel0be Date: Sat, 23 Apr 2016 14:15:09 -0400 Subject: [PATCH 1/2] Adding Pushover notifications --- duplicity-backup.conf.example | 3 +++ duplicity-backup.sh | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example index 5ac28fd..9aaccd6 100644 --- a/duplicity-backup.conf.example +++ b/duplicity-backup.conf.example @@ -418,6 +418,9 @@ SLACK_CHANNEL="#general" SLACK_USERNAME="duplicity-backup" SLACK_EMOJI="package" +# Provider: Pushover +PUSHOVER_TOKEN="token" # App token generated at pushover.net +PUSHOVER_USER="userkey" # User key from pushover.net # ------------------------------------------------------------------------------ # TROUBLESHOOTING diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 2782e69..4855828 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -410,8 +410,14 @@ send_notification() if [ ! -z "${NOTIFICATION_SERVICE}" ]; then if [ "${NOTIFICATION_SERVICE}" = "slack" ]; then 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}" - echo -e "Slack notification sent to channel ${SLACK_CHANNEL}" >> "${LOGFILE}" + elif [ "${NOTIFICATION_SERVICE}" = "pushover" ]; then + curl -s \ + -F "token=APP_TOKEN" \ + -F "user=USER_KEY" \ + -F "message=${NOTIFICATION_CONTENT}" \ + https://api.pushover.net/1/messages + echo -e "Pushover notification sent" >> "${LOGFILE}" fi fi } From 0501d2330361ae41a2f5ad30951a2c50c899349b Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 28 Apr 2016 15:58:49 -0400 Subject: [PATCH 2/2] fixed error --- duplicity-backup.conf.example | 5 +++-- duplicity-backup.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example index 9aaccd6..217381f 100644 --- a/duplicity-backup.conf.example +++ b/duplicity-backup.conf.example @@ -419,8 +419,9 @@ SLACK_USERNAME="duplicity-backup" SLACK_EMOJI="package" # Provider: Pushover -PUSHOVER_TOKEN="token" # App token generated at pushover.net -PUSHOVER_USER="userkey" # User key from pushover.net +PUSHOVER_TOKEN="" # App token generated at pushover.net +PUSHOVER_USER="" # User key from pushover.net + # ------------------------------------------------------------------------------ # TROUBLESHOOTING diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 4855828..62aadb8 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -413,8 +413,8 @@ send_notification() echo -e "Slack notification sent to channel ${SLACK_CHANNEL}" >> "${LOGFILE}" elif [ "${NOTIFICATION_SERVICE}" = "pushover" ]; then curl -s \ - -F "token=APP_TOKEN" \ - -F "user=USER_KEY" \ + -F "token=${PUSHOVER_TOKEN}" \ + -F "user=${PUSHOVER_USER}" \ -F "message=${NOTIFICATION_CONTENT}" \ https://api.pushover.net/1/messages echo -e "Pushover notification sent" >> "${LOGFILE}"