TUBS/README.md
2022-07-04 23:40:55 +02:00

70 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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
```
1. Create a folder in /etc with the name "tubs"
2. In there(/etc/tubs/) you have to copy the [scirpt](./tubs.sh)
3. Now create an [configuration file named "tubs.config"](./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](./tubs.sh) on Line 16 (CONFIG_FILE="path/to/file")
## Execution
1. Run the script with the "init" argument to create the directory structure in the destination
```
/etc/tubs/tubs.sh init
```
2. 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](mailto:janic@voser.cloud), 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.