Can specify backup to restore from

This commit is contained in:
Bob Mottram 2015-08-22 08:53:51 +01:00
parent 05d5092749
commit 9b317bf230
1 changed files with 6 additions and 1 deletions

View File

@ -7538,6 +7538,11 @@ function repair_databases_script {
echo '' >> /usr/bin/repairdatabase
echo 'DATABASE=$1' >> /usr/bin/repairdatabase
echo "EMAIL=$MY_EMAIL_ADDRESS" >> /usr/bin/repairdatabase
echo "BACKUP_TYPE='daily'" >> /usr/bin/repairdatabase
echo '' >> /usr/bin/repairdatabase
echo 'if [ $2 ]; then' >> /usr/bin/repairdatabase
echo ' BACKUP_TYPE=$2' >> /usr/bin/repairdatabase
echo 'fi' >> /usr/bin/repairdatabase
echo '' >> /usr/bin/repairdatabase
echo -n 'MYSQL_ROOT_PASSWORD=$(cat ' >> /usr/bin/repairdatabase
echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/repairdatabase
@ -7563,7 +7568,7 @@ function repair_databases_script {
echo '' >> /usr/bin/repairdatabase
echo '# If it still contains errors then restore from backup' >> /usr/bin/repairdatabase
echo 'if grep -q "Error" "$TEMPFILE"; then' >> /usr/bin/repairdatabase
echo ' mysql -u root --password=$MYSQL_ROOT_PASSWORD $DATABASE -o < /var/backups/${DATABASE}_daily.sql' >> /usr/bin/repairdatabase
echo ' mysql -u root --password=$MYSQL_ROOT_PASSWORD $DATABASE -o < /var/backups/${DATABASE}_${BACKUP_TYPE}.sql' >> /usr/bin/repairdatabase
echo '' >> /usr/bin/repairdatabase
echo ' # Send a warning email' >> /usr/bin/repairdatabase
echo ' echo "$DATABASE database corruption could not be repaired. Restored from backup." | mail -s "Freedombone database maintenance" $EMAIL' >> /usr/bin/repairdatabase