Skip to content

ownego/database-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

This script will help you to easily back up your MySQL database. It is especially helpful when use with crontab to automate backup progress. You can define a backup rotation scheme for each database.

Instalation

Require mysqldump and jq.

jq install instruction can be found here.

For CentOS:

wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x ./jq
cp jq /usr/bin

Clone the repo:

git clone https://github.com/ownego/database-backup.git

Then start to config:

cd database-backup
bash oe_db.sh -c

Usage

This script take 3 options:

-c to config database connections.

-a to run backup progress for all databases defined in config file.

-d database_name to run backup progress for one specific database (must be defined in config).

Each database config entry has 5 properties:

  • Database name
  • Database username
  • Database password
  • Database backup cycle (days)
  • Database backup directory (where to save backups)

Configuration file is JSON formatted and can be easily manually configured or shared.

Crontab usage

Examples:

00 00 * * * bash /path/to/oe_db.sh -a
00 12 * * * bash /path/to/oe_db.sh -d example_database

About

Bash script for backing up database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages