The Ultimate Backup Script
.ignoreme/Bash-OSS-Backup | ||
.gitignore | ||
LICENSE | ||
README.md | ||
tubs.config | ||
tubs.sh |
TUBS
The Ultimate Backup Script
Features
ID | NAME | STATE | Version |
---|---|---|---|
1 | Backup Directory | Working | 1.0 |
2 | Incremental Backup | Working | 1.1 |
3 | Initialisation | Working | 2.0 |
4 | Quick Help | Working | 2.0 |
5 | Remote Backup Location (SSH) | Working | 3.0 |
7 | Multiple Configuration files | Planned | 4.0 |
8 | MYSQL Backup | Planned | 5.0 |
Repository Structure
.
├── .git - Git stuff can be ignored
├── .gitignore - File to ignore when pushing
├── .ignoreme - Inspirational Files OSS(Cranix) Server
│ └── Bash-OSS-Backup - Original file
├── LICENSE - Apache 2.0 License
├── README.md - The file you are currenly reading
├── TEST - Tests can be ignored
├── tubs.config - The configuration file
└── tubs.sh - The accual backup script
Usage
File Structure on your system
/ - Root of your filesystem
├── var - stuff to backup (example)
└── etc - configuration directory
├── tubs.sh - Backup Script
└── tubs.config - Example configuration
- Create a folder in /etc with the name "tubs"
- In there(/etc/tubs/) you have to copy the scirpt
- Now create an configuration file named "tubs.config" in this directory you can see an example in this repo. If the path of this file is not exactly /etc/tubs/tubs.config, then you need to adjust this in the script on Line 16 (CONFIG_FILE="path/to/file")
Execution
- Run the script with the "init" argument to create the directory structure in the destination
/etc/tubs/tubs.sh init
- Run the script with the "backup" argument to run the backup job
/etc/tubs/tubs.sh backup
You will get colorful output if something does not work.
Cron Job
Create an cron job to run this script every day (or whenever you want)
crontab -e # to edit (then 'i': insert, ':wq!': save and quit)
10 * * * * /etc/tubs/tubs.sh backup # every hour at 10"
0 */4 * * * /etc/tubs/tubs.sh backup # every 4 hours at 0"
0 9-17 * * * /etc/tubs/tubs.sh backup # every hour at 0" between 9 and 17
0 2 * * * /etc/tubs/tubs.sh backup # daily at 2am
0 0 * * MON /etc/tubs/tubs.sh backup # every Monday at 0am
0 0 * * 1-5 /etc/tubs/tubs.sh backup # daily from Monday to Friday at 0am
0 0 * * 0 /etc/tubs/tubs.sh backup # weekly on Sunday
0 0 1 * * /etc/tubs/tubs.sh backup # monthly (1rst day at 0am)
0 0 1 */3 * /etc/tubs/tubs.sh backup # every quarter (1rst day at 0am)
0 0 1 1 * /etc/tubs/tubs.sh backup # yearly (01/01)
Issues
If you find an Issue, feel free to create an Issue or contact me, maby I see your message and if you have even more luck there could be the slight possibility that I know a solution to your Issue.