Merge pull request #1 from coacx/master
Added function for one password per backup + send passphrase via mail
This commit is contained in:
commit
7467ec890f
1 changed files with 12 additions and 6 deletions
|
@ -13,6 +13,8 @@
|
||||||
# you are allowed to use this just like you want on your own risk.
|
# you are allowed to use this just like you want on your own risk.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
EMAIL="mail@example.com"
|
||||||
|
|
||||||
# get day of the month
|
# get day of the month
|
||||||
DATE=`date +%d`
|
DATE=`date +%d`
|
||||||
|
|
||||||
|
@ -41,7 +43,8 @@ ENDDIR="/media/hddmount/duplicity"
|
||||||
LOGDIR='/var/log/duplicity' # must exist
|
LOGDIR='/var/log/duplicity' # must exist
|
||||||
|
|
||||||
# Setting the pass phrase to encrypt the backup files. Will use symmetrical keys in this case.
|
# Setting the pass phrase to encrypt the backup files. Will use symmetrical keys in this case.
|
||||||
PASSPHRASE='ult4a s3C43t!'
|
# Set one Password per Backup
|
||||||
|
PASSPHRASE=$(date|md5sum|awk '{print $1}')
|
||||||
export PASSPHRASE
|
export PASSPHRASE
|
||||||
|
|
||||||
# encryption algorithm for gpg, disable for default (CAST5)
|
# encryption algorithm for gpg, disable for default (CAST5)
|
||||||
|
@ -57,7 +60,7 @@ datum=$(date +"%d"."%m"."%y")
|
||||||
cd /
|
cd /
|
||||||
|
|
||||||
# find all databases
|
# find all databases
|
||||||
databases=`mysql -u $mysql_user -p$mysql_password -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|mysql)"`
|
databases=`mysql -u $mysql_user -p$mysql_password -e "SHOW DATABASES;" -Nsr | grep -Ev "(information_schema|performance_schema|mysql)"`
|
||||||
|
|
||||||
# export all databases
|
# export all databases
|
||||||
for db in $databases; do
|
for db in $databases; do
|
||||||
|
@ -119,14 +122,17 @@ do
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check the manpage for all available options for Duplicity.
|
|
||||||
# Unsetting the confidential variables
|
|
||||||
unset PASSPHRASE
|
|
||||||
unset FTP_PASSWORD
|
|
||||||
|
|
||||||
# Delete SQL Exports
|
# Delete SQL Exports
|
||||||
|
|
||||||
rm -r $temp
|
rm -r $temp
|
||||||
mkdir $temp
|
mkdir $temp
|
||||||
|
|
||||||
|
/usr/bin/mail -s "$(date) - $(hostname -f) - Backup complete!" $EMAIL <<< "Passphrase: ${PASSPHRASE}"
|
||||||
|
|
||||||
|
# Check the manpage for all available options for Duplicity.
|
||||||
|
# Unsetting the confidential variables
|
||||||
|
unset FTP_PASSWORD
|
||||||
|
unset PASSPHRASE
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue