requirements.yml,SETUP.md - prerequisites
This commit is contained in:
20
templates/docker-compose/borgmatic/backup.sh
Executable file
20
templates/docker-compose/borgmatic/backup.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Run the backup and mail the logs
|
||||
|
||||
BACKUP_COMMAND="borgmatic --stats"
|
||||
LOGFILE="/tmp/backup_run_$(date +%s).log"
|
||||
|
||||
set -o pipefail
|
||||
if $BACKUP_COMMAND 2>&1 | tee $LOGFILE; then
|
||||
SUBJECT_PREFIX="=?utf-8?Q? =E2=9C=85 SUCCESS?="
|
||||
SUCCESS=1
|
||||
else
|
||||
SUBJECT_PREFIX="=?utf-8?Q? =E2=9D=8C FAILED?="
|
||||
fi
|
||||
|
||||
if [ -z "$SUCCESS" ]; then
|
||||
echo -e "Subject: $SUBJECT_PREFIX: $MAIL_SUBJECT\n\n$(cat $LOGFILE)\n" |
|
||||
sendmail -t $MAIL_TO
|
||||
fi
|
||||
|
||||
rm $LOGFILE
|
||||
Reference in New Issue
Block a user