Migrate database password on repair script

This commit is contained in:
Bob Mottram 2016-11-21 12:22:27 +00:00
parent 9b4ed83e28
commit 7bc9089801
1 changed files with 12 additions and 0 deletions

View File

@ -44,6 +44,18 @@ ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
# Frequency - daily/weekly
BACKUP_TYPE='daily'
# migrate from database password file to using the password store
DATABASE_PASSWORD_FILE=/root/dbpass
if [ -f $DATABASE_PASSWORD_FILE ]; then
MARIADB_PASSWORD=$(cat $DATABASE_PASSWORD_FILE)
${PROJECT_NAME}-pass -u root -a mariadb -p "$MARIADB_PASSWORD"
stored_password=$(${PROJECT_NAME}-pass -u root -a mariadb)
if [[ "$stored_password" == "$MARIADB_PASSWORD" ]]; then
shred -zu $DATABASE_PASSWORD_FILE
fi
fi
MYSQL_ROOT_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
TEMPFILE=/root/repair-database-$DATABASE