The Ultimate Backup Script
Go to file
2022-07-04 23:41:07 +02:00
.ignoreme/Bash-OSS-Backup Restructuring 2022-07-04 23:40:22 +02:00
Bash-OSS-Backup TUBS initial push 2022-03-24 22:51:32 +01:00
OSS-Editing TUBS initial push 2022-03-24 22:51:32 +01:00
.gitignore new gitignore 2022-04-09 01:29:00 +02:00
LICENSE Updated License 2022-07-04 23:40:42 +02:00
README.md Better Readme 2022-07-04 23:40:55 +02:00
tubs.config Version 3.0 Add support for remote locations 2022-07-04 22:58:26 +02:00
tubs.sh Minor changes 2022-07-04 23:41:07 +02:00

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
  3. 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

  1. Run the script with the "init" argument to create the directory structure in the destination
    /etc/tubs/tubs.sh init
  1. 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.