-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
78 lines (53 loc) · 2.51 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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.