Skip to content

koshtech/bash_rsync_backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

# Bash Rsync Backup

A lite Bash script to do backups for many host to many hosts, includind or not theirs databases.

## Features:

 * Unlimited hosts
 * Simple config files
 * Run from Cron or command line
 * Dump and compact MySQL databases
 
## How to use it:

 Change to /opt:
 $ cd /opt
 Clone the repos:
 $ sudo git clone git://github.com/KoshTech/bash_rsync_backup.git
 Create a main script simlink:
 $ sudo ln -s /opt/bash_rsync_backup/bin/rsyncbackup /usr/local/bin/
 Copy base configuration files:
 $ cp -r /opt/bash_rsync_backup/etc/backup.d /etc/
 Create your backup:
 
 Goto into /etc/backup.d and make a copy of the host1* files:
 
 $ cd /etc/backup.d
 $ cp host1 myserver
 $ cp host1_exclude myserver_exclude
 
 Now edit myserver and make your changes:
 
 $ nano myserver
 
 Assume you want to make a 1st backup layer on a secound hard drive on same box,
 make your changes like:
 
 source_host="local" # A hostname here will make a remote backup. 'local' makes 
                     # a local backup. A 1st backup layer on a secound hard 
                     # drive on same box. 
 source_folders="/etc /usr/local /home/ /some/folder" # What we want to backup.
 exclude_from="myserver_exclude" # What we do not want to backup.
 destination_folder="/media/local_backup/" # Where we will put the backup in 
                                           # local or remote.
 destination_host="local" # 'local' makes a local backup. A 1st backup layer on 
                          # a secound hard drive on same box. A hostname here 
                          # will make a remote backup.
 
 Save and exit.
 Now edit and remove unwanted rows of myserver_exclude.
 
 Edit machines-enabled and change from host1 to myserver:
 
 nano machines-enabled
 
 
 Run your backups:
 $ rsyncbackup
 
 

### Old version

 Copy rsyncbackup.sh to /usr/local/bin
 copy host1, host1_exclude and machines-enabled files to /etc/backup.d
 Edit host1 as you needed
 
## Adding more hosts:

 Make a copy of /etc/backup.d/host1 to /etc/backup.d/host2 and adjust all values.
 Add the host2 at end of /etc/backup.d/machines-enabled and save it.
 
## How it works?

 The script looks at /etc/backup.d/machines-enabled to retreive a list of hosts.
 The file /etc/backup.d/host1 contains the settings for backup of host1 machine.
 The file /etc/backup.d/host1_exclude contains a list of files that must be ignored in backup.
 For MySQL backups just put the login and data for root user in /etc/backup.d/host1. If mysql login credentials are present the backup will dump all databases.

About

Simple Bash Rsync Backup for multlipe hosts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages