update readme
This commit is contained in:
parent
7f2592ed20
commit
e711321274
1 changed files with 56 additions and 0 deletions
56
README.md
56
README.md
|
@ -1,6 +1,62 @@
|
||||||
# Backup
|
# Backup
|
||||||
A flexible backup script for backing up linux system using rsync, ssh, cron and other common shell commands.
|
A flexible backup script for backing up linux system using rsync, ssh, cron and other common shell commands.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
First add your settings at the top of the file and then add a cronjob to periodically execute the script. In the following paragraphs the settings will be explained.
|
||||||
|
|
||||||
|
`SOURCES` is an array containing the paths to the folders that should be included in the backup.
|
||||||
|
|
||||||
|
`TARGET` the absolute path to the folder where the backup will be saved to. If the `TOSSH` option is used, this should of course be the absolute path on the remote system.
|
||||||
|
|
||||||
|
`EXCLUDEFROM` a path to a file containing folders and files that should be excluded from a backup.
|
||||||
|
|
||||||
|
`MAILADRESS` if this option is a non empty string, the log of the backup will be send to the email adress contained in this string. For this to work the `mail` command must be set up properly.
|
||||||
|
|
||||||
|
`LISTPACKAGES` if this option is set to a non empty string the log of the backup will contain a list of installed packages. For this command to work the `dpkg` command must be installed properly.
|
||||||
|
|
||||||
|
`LOG` the name of the log file.
|
||||||
|
|
||||||
|
`RSYNCCONF` an array that contains additional rsync flags.
|
||||||
|
|
||||||
|
`TOSSH` if this option is set to a non empty string, the backup will be saved on the remote host that this string refrences. **Attention:** Please set the `TOSSHUSER` and `TOSSHPORT` options as well, otherwise the script will probably fail to create a backup successfully.
|
||||||
|
|
||||||
|
`FROMSSH` if this option is set to a non empty string the folders refrenced in `SOURCES` will be fetched from the remote host refrenced by this string. **Attention:** Please set the `FROMSSHUSER` and `FROMSSHPORT` options as well otherwise the script might fail to create a backup successfully.
|
||||||
|
|
||||||
|
**Attention:** If both the `TOSSH` & `FROMSSH` options are set the script will fail!
|
||||||
|
|
||||||
|
### Settings example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## General Settings
|
||||||
|
SOURCES=(/home/example) # What folder should be saved?
|
||||||
|
TARGET="/home/backup/example" # Where should they be saved? (absolute path!)
|
||||||
|
EXCLUDEFROM="~/exclude.txt" # What files are supposed to be excluded?
|
||||||
|
MAILADRESS="example@example.com" # To which email adress should the logs be sent?
|
||||||
|
LISTPACKAGES="" # Change to non empty string to save a list of
|
||||||
|
# installed packages!
|
||||||
|
LOG=$0.log # Log file name & location
|
||||||
|
RSYNCCONF=(--delete) # Additional rsync flags
|
||||||
|
|
||||||
|
## SSH Settings
|
||||||
|
TOSSH="my.backup.com" # What ssh server stores the backups?
|
||||||
|
FROMSSH="" # From what ssh server should the files be
|
||||||
|
# backuped?
|
||||||
|
# For several reasons TOSSH and FROMSSH cannot
|
||||||
|
# be used at the same time!
|
||||||
|
TOSSHUSER="example" # The ssh user
|
||||||
|
TOSSHPORT=22 # The ssh port
|
||||||
|
FROMSSHUSER="" # The ssh user
|
||||||
|
FROMSSHPORT=22 # The ssh port
|
||||||
|
```
|
||||||
|
|
||||||
|
### Crontab example
|
||||||
|
Create a backup every two hours:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
0 */2 * * * ~/backup.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Inspiration
|
## Inspiration
|
||||||
|
|
||||||
- [Backup mit RSYNC](https://wiki.ubuntuusers.de/Skripte/Backup_mit_RSYNC/)
|
- [Backup mit RSYNC](https://wiki.ubuntuusers.de/Skripte/Backup_mit_RSYNC/)
|
||||||
|
|
Loading…
Reference in a new issue