Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call restic backup script with nice (wip) #111

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ Available variables:
| `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``. |
| `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:
```yaml
Expand All @@ -197,6 +198,7 @@ restic_backups:
stdin_filename: db_name_dump.sql
scheduled: true
schedule_oncalendar: '*-*-* 01:30:00'
niceness: 10
```

> You can also specify restic_backups as an array, which is a legacy feature and
Expand Down
4 changes: 4 additions & 0 deletions templates/restic.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Type=oneshot
{% if item.lvm is defined %}
PrivateMounts=on
{% 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
{% endif %}
TimeoutStartSec=0
Environment="CRON=true"