2024-10-08 14:43:54 +09:00
|
|
|
# PgBackRest backup wrapper
|
|
|
|
|
|
|
|
|
|
Wrapper to call the full/differential backup on all stanzas
|
|
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
|
|
```txt
|
|
|
|
|
-b (backuptype): full/diff
|
2024-10-08 15:44:18 +09:00
|
|
|
-s (stanza): override stanza name, must be in stanza.cfg file
|
2024-10-08 14:43:54 +09:00
|
|
|
-l list available stanza
|
|
|
|
|
-t test run
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Either `-l` or `-b` option must be set
|
2024-10-08 15:44:18 +09:00
|
|
|
|
|
|
|
|
## Config
|
|
|
|
|
|
|
|
|
|
Two files must be created
|
|
|
|
|
|
|
|
|
|
### `config/pgbackrest.cfg`
|
|
|
|
|
|
|
|
|
|
Example file is `pgbackrest.sample.cfg`
|
|
|
|
|
|
2025-12-02 15:13:58 +09:00
|
|
|
This file holds the sudo_user for calling the commands and the main pgbackrest config file.
|
|
|
|
|
If the super user or config file does not exists an error will be shown
|
2024-10-08 15:44:18 +09:00
|
|
|
|
|
|
|
|
```ini
|
|
|
|
|
[PgBackRest]
|
2025-12-02 13:24:54 +09:00
|
|
|
sudo_user=postgres
|
2025-12-02 15:13:58 +09:00
|
|
|
pgbackrest_config=/etc/pgbackrest.conf
|
2024-10-08 15:44:18 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### `config/stanza.cfg`
|
|
|
|
|
|
|
|
|
|
Example file is `stanza.sample.cfg`
|
|
|
|
|
|
|
|
|
|
This files holds the stanzas to backup
|
|
|
|
|
|
2025-12-02 14:55:36 +09:00
|
|
|
`stanza:repo number:path to config file:super user`
|
2025-12-02 14:44:18 +09:00
|
|
|
|
2025-12-02 13:24:54 +09:00
|
|
|
If the stanza has several repo settings as in "repo1-...", "repo2-..." then the repo to target can be listed in here by ":repo number"
|
|
|
|
|
|
2025-12-02 14:44:18 +09:00
|
|
|
The third optional parameter is a config file path
|
|
|
|
|
|
2025-12-02 14:55:36 +09:00
|
|
|
The forth optional parameter is the super user to use
|
|
|
|
|
|
|
|
|
|
If parameters are not used but laters are, the empties need to be set with just the ":"
|
|
|
|
|
|
2025-12-02 15:13:58 +09:00
|
|
|
`stanza::/config`
|
|
|
|
|
|
|
|
|
|
The script checks for the following things during each run
|
|
|
|
|
|
|
|
|
|
- stanza name exists in the main config file, or in the override config file if set
|
|
|
|
|
- check if repo number exist in main config file, or in the override config file if set
|
|
|
|
|
- override config file exists
|
|
|
|
|
- override super does not exist
|
2025-12-02 14:55:36 +09:00
|
|
|
|
2024-10-08 15:44:18 +09:00
|
|
|
```ini
|
|
|
|
|
[stanzas]
|
|
|
|
|
stanza_a
|
2025-12-02 13:24:54 +09:00
|
|
|
stanza_b:1
|
|
|
|
|
stanza_b:2
|
2025-12-02 14:44:18 +09:00
|
|
|
stanza_c::/etc/to/config
|
2025-12-02 14:55:36 +09:00
|
|
|
stanza_d:::super user
|
2024-10-08 15:44:18 +09:00
|
|
|
```
|