mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-09-25 20:31:52 +02:00
Use RESTIC_HOST for notifications instead of HOSTNAME
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set RESTIC_HOST to hostname if not present
|
||||||
|
export RESTIC_HOST=${RESTIC_HOST:-$(hostname)}
|
||||||
|
|
||||||
# Backup one directory (from the mounted filesystem)
|
# Backup one directory (from the mounted filesystem)
|
||||||
function backup_dir {
|
function backup_dir {
|
||||||
# Check if the dir to backup is mounted as a subdirectory of /root inside this container
|
# Check if the dir to backup is mounted as a subdirectory of /root inside this container
|
||||||
@@ -143,12 +146,12 @@ if [ "$1" == "" ] || [ "$1" == "backup" ]; then
|
|||||||
|
|
||||||
# Send a notification to Slack
|
# Send a notification to Slack
|
||||||
if [[ "$SLACK_URL" != "" ]] ; then
|
if [[ "$SLACK_URL" != "" ]] ; then
|
||||||
curl -o /dev/null -s -m 10 --retry 5 -X POST --data-urlencode "payload={\"username\": \"rpi-docker-backup\", \"icon_emoji\": \":dvd:\", \"text\": \"Backup finished on host $HOSTNAME : $count_success succeeded, $count_failure failed\"}" $SLACK_URL
|
curl -o /dev/null -s -m 10 --retry 5 -X POST --data-urlencode "payload={\"username\": \"rpi-docker-backup\", \"icon_emoji\": \":dvd:\", \"text\": \"Backup finished on host $RESTIC_HOST : $count_success succeeded, $count_failure failed\"}" $SLACK_URL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Send a notification to Gotify
|
# Send a notification to Gotify
|
||||||
if [[ "$GOTIFY_URL" != "" ]] ; then
|
if [[ "$GOTIFY_URL" != "" ]] ; then
|
||||||
curl -o /dev/null -s -m 10 --retry 5 -X POST -H "accept: application/json" -H "Content-Type: application/json" -d "{\"priority\": 5, \"title\": \"Backup finished on host $HOSTNAME\", \"message\": \"Backup finished on host $HOSTNAME : $count_success succeeded, $count_failure failed\"}" $GOTIFY_URL
|
curl -o /dev/null -s -m 10 --retry 5 -X POST -H "accept: application/json" -H "Content-Type: application/json" -d "{\"priority\": 5, \"title\": \"Backup finished on host $RESTIC_HOST\", \"message\": \"Backup finished on host $RESTIC_HOST : $count_success succeeded, $count_failure failed\"}" $GOTIFY_URL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Return a non zero exit code if an error happened
|
# Return a non zero exit code if an error happened
|
||||||
|
|||||||
Reference in New Issue
Block a user