Update config-example and b2backup, add ipabackup
This commit is contained in:
parent
11c7f9b67b
commit
b02208fe4c
@ -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"
|
||||
@ -31,4 +30,4 @@ rm $MAILFILE
|
||||
|
||||
for var in $(awk -F"=" '{print $1}' ${PWD}/config.txt); do
|
||||
unset $var
|
||||
done
|
||||
done
|
||||
|
@ -20,4 +20,7 @@ PGSQL_PATH=/path/to/sqlbackups/postgres
|
||||
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"
|
||||
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
24
ipabackup.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user