diff --git a/README.md b/README.md index ccf3782..f24ca20 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,28 @@ configuration file in `/etc/borgwrapper/` do: systemctl start borgwrapper-backup@.timer systemctl start borgwrapper-verify@.timer +The included systemd files are set up using a daily schedule. If you want to +take backups more often than that you can either change the `Timer` parameters +directly in the systemd timer files, or if you only want to override them for +some of the backups you can add per-config overrides by using + + systemctl edit borgwrapper-backup@ + +and add the wanted overrides. Here is an example where you run a backup 4 times +a day (every 6 hours). See the manual for systemd.timer for more information on +the `OnCalendar` format. + + [Timer] + OnCalendar=00/6:00 + RandomizedDelaySec=0 + +The output will land in + + /etc/systemd/system/borgwrapper-backup@.timer.d/override.conf + +You can just drop files in the directory directly too, without editing via +systemctl. This is better suited for configuration management systems. + You can view the backup logs with: journalctl -xu borgwrapper-backup@ diff --git a/src/borgwrapper b/src/borgwrapper index e33d18b..b1f3166 100755 --- a/src/borgwrapper +++ b/src/borgwrapper @@ -86,10 +86,11 @@ borg_prune () { ${BORG} prune \ "${BORG_PRUNE_ARGS[@]}" \ --prefix "{hostname}-" \ - --keep-daily=${KEEP_DAILY} \ - --keep-weekly=${KEEP_WEEKLY} \ - --keep-monthly=${KEEP_MONTHLY} \ - --keep-yearly=${KEEP_YEARLY} \ + --keep-hourly=${KEEP_HOURLY:-0} \ + --keep-daily=${KEEP_DAILY:-0} \ + --keep-weekly=${KEEP_WEEKLY:-0} \ + --keep-monthly=${KEEP_MONTHLY:-0} \ + --keep-yearly=${KEEP_YEARLY:-0} \ "${BORG_REPO}" } diff --git a/src/config.example b/src/config.example index 7924c37..052d37c 100644 --- a/src/config.example +++ b/src/config.example @@ -17,6 +17,7 @@ EXCLUDES=( "/root/.cache" "*.pyc" ) +KEEP_HOURLY=0 KEEP_DAILY=31 KEEP_WEEKLY=0 KEEP_MONTHLY=24