25 lines
632 B
Bash
25 lines
632 B
Bash
#!/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
|