Update config-example and b2backup, add ipabackup

This commit is contained in:
Russ Long 2022-08-18 14:06:59 +00:00
parent 11c7f9b67b
commit b02208fe4c
3 changed files with 29 additions and 3 deletions

View File

@ -19,7 +19,6 @@ echo "Backup Complete. Currently available snapshots:" > $MAILFILE
echo "<pre style='font:monospace'>" >> $MAILFILE
echo "$(/usr/bin/restic snapshots)" >> $MAILFILE
(
echo "Subject: $EMAILSUB"
echo "From: $SENDER"

View File

@ -21,3 +21,6 @@ MYSQL_PATH=/path/to/sqlbackups/mysql
SQL_AUTH_FILE=/path/to/sqlauth.txt
PGSQL_CONTAINER_NAMES="space separated list of containers running pgsql"
MYSQL_CONTAINER_NAMES="space separated list of containers running mysql or mariadb"
IPA_EMAILSUB="FreeIPA Backup Complete"
IPA_CONTAINERNAME="freeipa-master-1"
IPA_BACKUP_PATH="/opt/ipabackups"

24
ipabackup.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
MAILFILE="/tmp/ipamailtxt"
SERVER_NAME=$HOSTNAME
SENDER=$(whoami)
USER="noreply"
MAILHEADER="/opt/b2backup/mailheader.txt"
MAILFOOTER="/opt/b2backup/mailfooter.txt"
. ${PWD}/config.txt
export CONTNAME="$IPA_CONTAINER_NAME"
export BACKUP_PATH="$IPA_BACKUP_PATH"
docker exec $CONTNAME ipa-backup > /dev/null 2>&1
echo "FreeIPA Backup Complete. Currently available backups:" > $MAILFILE
echo "<pre style='font:monospace'>" >> $MAILFILE
echo "$(ls -1 $BACKUP_PATH | sort -nr)" >> $MAILFILE
(
echo "Subject: $EMAILSUB"
echo "From: $SENDER"
echo "To: $RECIPIENT"
cat $MAILHEADER $MAILFILE $MAILFOOTER
) | sendmail -t