README, init_backup and make_bakup.
This commit is contained in:
32
README.MD
32
README.MD
@@ -4,9 +4,9 @@ This repository contains some helper scripts to get you started with making back
|
|||||||
|
|
||||||
Everything is controlled by .env files.
|
Everything is controlled by .env files.
|
||||||
|
|
||||||
### Files
|
# Files
|
||||||
|
|
||||||
#### backup.env
|
## backup.env
|
||||||
|
|
||||||
copy the file backup.env.sample to backup.env and start configuring it to your liking.
|
copy the file backup.env.sample to backup.env and start configuring it to your liking.
|
||||||
|
|
||||||
@@ -53,20 +53,22 @@ Keep it safe and secure.
|
|||||||
DO NOT USE THIS AS YOUR PASSPHRASE.
|
DO NOT USE THIS AS YOUR PASSPHRASE.
|
||||||
(And no, this is NOT my passphrase, it is some random garbage)
|
(And no, this is NOT my passphrase, it is some random garbage)
|
||||||
|
|
||||||
### backup_exclude.txt
|
## backup_exclude.txt
|
||||||
A file containing files/directories that should NOT be included in the backup, this can be tmpfiles, virtual filesystems or mounted network devices that might not always be thre or inflate the backup size.
|
A file containing files/directories that should NOT be included in the backup, this can be tmpfiles, virtual filesystems or mounted network devices that might not always be there or inflate the backup size.
|
||||||
A good "default" exclude file is included in ```backup_exclude.txt.sample```
|
A good "default" exclude file is included in ```backup_exclude.txt.sample```
|
||||||
|
|
||||||
### init_backup.sh
|
## init_backup.sh
|
||||||
|
An interactive helper script to get you started, this includes creating ssh keys, collecting information for your backup.env file and much more.
|
||||||
|
Have your server/login information ready and follow carefully, if at any point there is issues you should interrupt and correct before retrying.
|
||||||
|
When everything goes well it will in the end initialize the remote repository for you, once that is done you are ready to take backups once the settings shown are transferred to your ```.env``` file.
|
||||||
|
|
||||||
Todo
|
## make_backup.sh
|
||||||
|
Once repository is initialized with ```init_backup.sh``` and your ```.env``` file is filled, you can make your first backup.
|
||||||
### make_backup.sh
|
This file is the "meat" of your backup, it is responsilbe (together with your ```.env``` file) for making the backups.
|
||||||
|
In the end the ```mail_template.py``` is called to send you an email, this can be commented out if you want to supress emails (this should be a setting in .env).
|
||||||
Todo
|
|
||||||
|
|
||||||
|
|
||||||
### mail_template.py
|
## mail_template.py
|
||||||
File containing email template as well as subject and list of email recievers.
|
File containing email template as well as subject and list of email recievers.
|
||||||
```
|
```
|
||||||
recivers = ["example@example.com", "example2@example.com"]
|
recivers = ["example@example.com", "example2@example.com"]
|
||||||
@@ -79,7 +81,7 @@ It is made to be called by ```make_backup.sh``` and expects the LASTLOG environm
|
|||||||
LASTLOG points to a a logfile containing only the result of the latest backup done.
|
LASTLOG points to a a logfile containing only the result of the latest backup done.
|
||||||
|
|
||||||
|
|
||||||
### secrets.env
|
## secrets.env
|
||||||
Contains mailserver configuration in an oldschool INI file format.
|
Contains mailserver configuration in an oldschool INI file format.
|
||||||
```
|
```
|
||||||
[MAIL]
|
[MAIL]
|
||||||
@@ -94,19 +96,19 @@ If you use something else and get it working, let me know.
|
|||||||
|
|
||||||
Allow me to repeat... KEEP THIS SECRET, you don't want someone to abuse your email.
|
Allow me to repeat... KEEP THIS SECRET, you don't want someone to abuse your email.
|
||||||
|
|
||||||
### etc/systemd/system/make-backup.service
|
## etc/systemd/system/make-backup.service
|
||||||
Systemd service to make backup.
|
Systemd service to make backup.
|
||||||
```WorkingDirectory=``` should be the absolute path to where ```make_backup.sh``` script is located.
|
```WorkingDirectory=``` should be the absolute path to where ```make_backup.sh``` script is located.
|
||||||
```ExecStart=``` *MUST* be the absolute path to ```make_backup.sh```
|
```ExecStart=``` *MUST* be the absolute path to ```make_backup.sh```
|
||||||
|
|
||||||
### etc/systemd/system/make-backup.timer
|
## etc/systemd/system/make-backup.timer
|
||||||
Systemd timer to trigger backup.
|
Systemd timer to trigger backup.
|
||||||
When backups are made is defined in the line:
|
When backups are made is defined in the line:
|
||||||
```OnCalendar= 04:00```
|
```OnCalendar= 04:00```
|
||||||
This currently does a backup at 04:00 every day, it could also be expressed by ```OnCalendar=daily``` but this would always trigger at ```00:00:00```
|
This currently does a backup at 04:00 every day, it could also be expressed by ```OnCalendar=daily``` but this would always trigger at ```00:00:00```
|
||||||
See ```man systemd.time``` for more how to configure OnCalendar events.
|
See ```man systemd.time``` for more how to configure OnCalendar events.
|
||||||
|
|
||||||
### Systemd service+timer install
|
## Systemd service+timer install
|
||||||
Configure the trigger in the .timer, remember to change "Description" in both .service and .timer.
|
Configure the trigger in the .timer, remember to change "Description" in both .service and .timer.
|
||||||
|
|
||||||
```systemd-analyze verify make-backup.*```
|
```systemd-analyze verify make-backup.*```
|
||||||
|
|||||||
Reference in New Issue
Block a user