2019-09-11 00:15:08 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Password can't be empty
|
|
|
|
test -n "${BORG_PASSPHRASE}"
|
|
|
|
|
|
|
|
date="$(date +%F)"
|
|
|
|
orig=/srv/data
|
|
|
|
dest=/srv/backups
|
|
|
|
|
2019-09-30 19:46:17 +00:00
|
|
|
# Let other users have read access, since the backup is encrypted
|
|
|
|
# anyway. This allows for synchronization from other containers.
|
|
|
|
umask 0022
|
|
|
|
|
2019-09-11 00:15:08 +00:00
|
|
|
test -f "${dest}/config" || borg init --encryption=repokey "${dest}"
|
|
|
|
|
|
|
|
borg create -v --stats "${dest}::${date}" "${orig}"
|
|
|
|
borg prune -v --stats --keep-daily ${KEEP} "${dest}"
|
|
|
|
|
|
|
|
exit $?
|