My backup scripts and tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
628 B

  1. #!/bin/bash
  2. set -e
  3. . "$(dirname "$0")"/vars.sh
  4. # Send notification email using a script on the backup host
  5. # First argument is our hostname, second argument is destination;
  6. # mail body is provided on stdin.
  7. if tty -s ; then
  8. echo 'Refusing to read mail body from terminal'
  9. exit 1
  10. fi
  11. SUMMARY="$1"
  12. EMAIL="$2"
  13. # Remote notify.sh wants subject as first line, not as an argument,
  14. # since it's a bit messy to pass complex strings through ssh command
  15. # lines.
  16. ( echo "backup $HOSTNAME: $SUMMARY" ; cat ) | \
  17. ssh \
  18. -F "$SSH/config" \
  19. -i "$SSH/id_ecdsa_notify" \
  20. "$BACKUP_USER@$BACKUP_HOST" \
  21. borg/notify.sh "$EMAIL"