项目作者: msergiy87

项目描述 :
Simple server mysql dump and data backup
高级语言: Shell
项目地址: git://github.com/msergiy87/simple_backup.git
创建时间: 2015-09-29T14:07:32Z
项目社区:https://github.com/msergiy87/simple_backup

开源协议:

下载


simple_backup

mysql dump and data backup. You can save last 5 daily backups in /data/backups/daily_data /data/backups/daily_mysql_dump and last 3 monthly backup (together data and mysql dump) in /data/backups/monthly_dump_and_data. Monthly backup contains data for 4 days before the end of the each month.

Distros tested

Currently, this is only tested on Debian 7.9. It should theoretically work on older versions of Ubuntu or Debian based systems.

Usage

1 ) add crontab tasks

  1. 03 02 1 * * /root/scripts/backup.sh monthly > /dev/null 2>&1
  2. 03 03 * * * /root/scripts/backup.sh mysql > /dev/null 2>&1
  3. 23 03 * * * /root/scripts/backup.sh daily > /dev/null 2>&1

2 ) change rights and owner

  1. chmod 744 *.sh
  2. chmod 644 logrotate_backup_*
  3. chmown root:root ../simple_backup -R

3 ) move logrotate files to /etc/

  1. mv logrotate_backup_* /etc/

4 ) move scripts to /root/scripts/

  1. mkdir -p /root/scripts
  2. mv *.sh /root/scripts

5 ) change variable SITE_LOCATION and USER, PASSWORD (use script instructions for create mysql user)

  1. #CREATE USER 'fsbackup'@'localhost' IDENTIFIED BY 'mysecurepass';
  2. #GRANT SELECT, FILE, SHOW DATABASES, LOCK TABLES, SHOW VIEW ON *.* TO 'fsbackup'@'localhost' IDENTIFIED BY 'mysecurepass';
  3. #flush privileges;

6 ) change_logrotate.sh - create or change logrotate scenario for sites