Merge branch 'main' into pre_backup_cmd

Signed-off-by: L3D <l3d@c3woc.de>
This commit is contained in:
L3D 2024-01-26 15:45:44 +01:00 committed by GitHub
commit 4b5477dd70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -180,6 +180,7 @@ Available variables:
| `mail_on_error` | no | Optionally send a mail if the backupjob will fail *(mailx is required)* | | `mail_on_error` | no | Optionally send a mail if the backupjob will fail *(mailx is required)* |
| `mail_address` | if `mail_on_error` is true | The mail addressto recive mails if you enabled ``mail_on_error``. | | `mail_address` | if `mail_on_error` is true | The mail addressto recive mails if you enabled ``mail_on_error``. |
| `monitoring_call` | no | A command that will be called if the backup is *successful*. Useful for heartbeat monitoring systems that warn when no heartbeat is received. Use the full command, you need to run. Example: `curl https://monitoring.example.com/api/push/E9Wzm4lJ2O?status=up&msg=OK&ping=` | | `monitoring_call` | no | A command that will be called if the backup is *successful*. Useful for heartbeat monitoring systems that warn when no heartbeat is received. Use the full command, you need to run. Example: `curl https://monitoring.example.com/api/push/E9Wzm4lJ2O?status=up&msg=OK&ping=` |
| `niceness` | no | If set, runs any scheduled backup with given [niceness-value](https://en.wikipedia.org/wiki/Nice_(Unix)). On Linux -20 is highest priority, 0 default and 19 is lowest priority. 10 is a common low priority assigned to backup routines on production systems. |
Example: Example:
```yaml ```yaml
@ -198,6 +199,7 @@ restic_backups:
stdin_filename: db_name_dump.sql stdin_filename: db_name_dump.sql
scheduled: true scheduled: true
schedule_oncalendar: '*-*-* 01:30:00' schedule_oncalendar: '*-*-* 01:30:00'
niceness: 10
all_databases: all_databases:
name: all_databases name: all_databases
repo: remote repo: remote
@ -205,6 +207,7 @@ restic_backups:
scheduled: true scheduled: true
schedule_oncalendar: '*-*-* 02:00:00' schedule_oncalendar: '*-*-* 02:00:00'
pre_backup_cmd: cd /var/dumped_data && mariadb -N -e 'show databases' | while read dbname; do mariadb-dump --complete-insert --routines --triggers --single-transaction "$dbname" > "$dbname".sql; done pre_backup_cmd: cd /var/dumped_data && mariadb -N -e 'show databases' | while read dbname; do mariadb-dump --complete-insert --routines --triggers --single-transaction "$dbname" > "$dbname".sql; done
``` ```
> You can also specify restic_backups as an array, which is a legacy feature and > You can also specify restic_backups as an array, which is a legacy feature and

View file

@ -10,6 +10,10 @@ Type=oneshot
{% if item.lvm is defined %} {% if item.lvm is defined %}
PrivateMounts=on PrivateMounts=on
{% endif %} {% endif %}
{% if item.niceness is defined %}
ExecStart=/usr/bin/nice -n {{ item.niceness }} {{ restic_script_dir }}/backup-{{ item.name }}.sh
{% else %}
ExecStart={{ restic_script_dir }}/backup-{{ item.name }}.sh ExecStart={{ restic_script_dir }}/backup-{{ item.name }}.sh
{% endif %}
TimeoutStartSec=0 TimeoutStartSec=0
Environment="CRON=true" Environment="CRON=true"