borg-backup-server: log prune output to file
This saves prune output to a log file automatically. Add a bit more info on the process too. Change-Id: I2607ddbc313dfebc122609af78bb5eed63906f6b
This commit is contained in:
parent
eb965a7992
commit
3d63b3b8a4
@ -302,10 +302,13 @@ roll-back to a known good state; see
|
||||
|
||||
However, we have limited backup space. Each backup server has a
|
||||
script ``/usr/local/bin/prune-borg-backups`` which can be run to
|
||||
reclaim space. This will keep the last 7 days of backups, then
|
||||
monthly backups for 1 year and yearly backups for each archive. The
|
||||
backup servers will send a warning when backup volume usage is high,
|
||||
at which point this can be run manually.
|
||||
reclaim space. This should be run in a ``screen`` instance as it can
|
||||
take a considerable time. It will prompt when run; you can confirm
|
||||
the process with a ``noop`` run; confirming the prune will log the
|
||||
output to ``/opt/backups``. This will keep the last 7 days of backups,
|
||||
then monthly backups for 1 year and yearly backups for each archive.
|
||||
The backup servers will send a warning when backup volume usage is
|
||||
high, at which point this can be run manually.
|
||||
|
||||
.. _force-merging-a-change:
|
||||
|
||||
|
@ -10,6 +10,10 @@ if [[ ${borg_op} == 'noop' ]]; then
|
||||
BORG_OP='--dry-run'
|
||||
elif [[ ${borg_op} == 'prune' ]]; then
|
||||
BORG_OP=''
|
||||
LOG_FILE="/opt/backups/prune-$(date '+%Y-%m-%d-%H-%M-%S').log"
|
||||
echo "*** Logging output to ${LOG_FILE}"
|
||||
exec 1>${LOG_FILE}
|
||||
exec 2>&1
|
||||
else
|
||||
echo "*** Invalid input"
|
||||
exit 1
|
||||
@ -31,7 +35,7 @@ for u in borg-*; do
|
||||
echo
|
||||
echo
|
||||
echo "+------"
|
||||
echo "| Pruning ${BORG_REPO} archive ${prefix}"
|
||||
echo "| $(date) Pruning ${BORG_REPO} archive ${prefix}"
|
||||
echo "+------"
|
||||
/opt/borg/bin/borg prune --prefix ${prefix} ${BORG_OP} --verbose --list --show-rc --keep-daily 7 --keep-weekly 4 --keep-monthly 12
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user