Can specify backup to restore from
This commit is contained in:
parent
05d5092749
commit
9b317bf230
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue