#!/bin/bash
printf "importing...\n"
sudo mysql -u root -pdbas --default-character-set=utf8mb4 < backupdb2.sql
printf "optimizing...\n"
sudo mysql -u root -pdbas --default-character-set=utf8mb4 < optimize.sql
printf "stopping mariadb service\n"
sudo service mariadb stop
printf "truncating logs\n"
sudo truncate /var/log/mariadb/adrastea.log -s 0
sudo truncate /var/log/mariadb/adrastea-slow.log -s 0
printf "restarting mariadb service\n"
sudo service mariadb start
