Scheduled MySQL dump & check.
Features
- Creates GZip MySQL backups
- Optimizes/Repairs MySQL database
- Deletes old backups after a specified time
- Usable with cron, but also manually
- Environment file support
- Global environment variables support
- Supports MariaDb
- Logging
mkdir -p ~/bin && \
wget https://raw.githubusercontent.com/cakebake/EightDump/main/eightdump.sh -O ~/bin/eightdump && \
chmod +x ~/bin/eightdump
Check if
~/bin
is in the global $PATH or add it. Example:echo "export PATH=$PATH:$HOME/bin" >> ~/.bashrc
Create or edit a configuration file with following variables.
BACKUP_USER=user
BACKUP_PASSWORD=password
BACKUP_HOST=localhost
BACKUP_PORT=3306
BACKUP_DATABASE=name
BACKUP_DESTINATION_DIR=/var/www/html/project/backup
BACKUP_KEEP_MINUTES=10080
CLI
eightdump /path/to/.env
Cron
# every day 04h00
0 4 * * * /home/name/bin/eightdump /path/to/.env >/dev/null 2>&1
# every 6h
0 */6 * * * /home/name/bin/eightdump /path/to/.env >/dev/null 2>&1