Add support for hourly backups

Also include description for setting custom systemd timer schedules

Fixes #4
dev
hk 2020-01-11 12:40:55 +01:00
parent 9d2c564ba2
commit 2fd83ac69f
3 changed files with 28 additions and 4 deletions

View File

@ -27,6 +27,28 @@ configuration file in `/etc/borgwrapper/<config_name>` do:
systemctl start borgwrapper-backup@<config_name>.timer systemctl start borgwrapper-backup@<config_name>.timer
systemctl start borgwrapper-verify@<config_name>.timer systemctl start borgwrapper-verify@<config_name>.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@<config>
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@<config>.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: You can view the backup logs with:
journalctl -xu borgwrapper-backup@<config_name> journalctl -xu borgwrapper-backup@<config_name>

View File

@ -86,10 +86,11 @@ borg_prune () {
${BORG} prune \ ${BORG} prune \
"${BORG_PRUNE_ARGS[@]}" \ "${BORG_PRUNE_ARGS[@]}" \
--prefix "{hostname}-" \ --prefix "{hostname}-" \
--keep-daily=${KEEP_DAILY} \ --keep-hourly=${KEEP_HOURLY:-0} \
--keep-weekly=${KEEP_WEEKLY} \ --keep-daily=${KEEP_DAILY:-0} \
--keep-monthly=${KEEP_MONTHLY} \ --keep-weekly=${KEEP_WEEKLY:-0} \
--keep-yearly=${KEEP_YEARLY} \ --keep-monthly=${KEEP_MONTHLY:-0} \
--keep-yearly=${KEEP_YEARLY:-0} \
"${BORG_REPO}" "${BORG_REPO}"
} }

View File

@ -17,6 +17,7 @@ EXCLUDES=(
"/root/.cache" "/root/.cache"
"*.pyc" "*.pyc"
) )
KEEP_HOURLY=0
KEEP_DAILY=31 KEEP_DAILY=31
KEEP_WEEKLY=0 KEEP_WEEKLY=0
KEEP_MONTHLY=24 KEEP_MONTHLY=24