Add schedule for full backups and restore args

This commit is contained in:
ViViDboarder 2017-07-30 12:18:12 -07:00
parent 6c28a96a22
commit 917a4577c5
7 changed files with 14 additions and 3 deletions

View File

@ -20,6 +20,7 @@ ENV PASSPHRASE="Correct.Horse.Battery.Staple"
# Cron schedules
ENV CRON_SCHEDULE=""
ENV FULL_CRON_SCHEDULE=""
ENV VERIFY_CRON_SCHEDULE=""
ADD backup.sh /

View File

@ -19,6 +19,7 @@ ENV PASSPHRASE="Correct.Horse.Battery.Staple"
# Cron schedules
ENV CRON_SCHEDULE=""
ENV FULL_CRON_SCHEDULE=""
ENV VERIFY_CRON_SCHEDULE=""
ADD backup.sh /

View File

@ -1,9 +1,11 @@
.PHONY: build-x86 build-arm build-all
.PHONY: build-x86 build-arm build-all test
DOCKER_TAG ?= docker-duplicity-cron
default: build-x86
test: test-x86
build-x86:
docker build -f ./Dockerfile.ubuntu -t $(DOCKER_TAG):ubuntu .

View File

@ -12,8 +12,9 @@ Mount any directories you'd like to back up as a volume and run
|BACKUP_DEST|file:///backups|Destination to store backups (See [duplicity documenation](http://duplicity.nongnu.org/duplicity.1.html#sect7))|
|BACKUP_NAME|backup|What the name for the backup should be. If using a single store for multiple backups, make sure this is unique|
|CLEANUP_COMMAND| |An optional duplicity command to execute after backups to clean older ones out (eg. "remove-all-but-n-full 2")|
|CRON_SCHEDULE| |If you want to backup on a schedule, provide it here. By default we just backup once and exit|
|CRON_SCHEDULE| |If you want to periodic incremental backups on a schedule, provide it here. By default we just backup once and exit|
|FTP_PASSWORD| |Used to provide passwords for some backends. May not work without an attached TTY|
|FULL_CRON_SCHEDULE| |If you want to periodic full backups on a schedule, provide it here. This requires an incremental cron schedule too.|
|GPG_KEY_ID| |The ID of the key you wish to use. See [Encryption](#encryption) section below|
|OPT_ARGUMENTS| |Any additional arguments to provide to the duplicity backup command. These can also be provided as additional arguments via the command line|
|PASSPHRASE|Correct.Horse.Battery.Staple|Passphrase to use for GPG|

View File

@ -2,6 +2,7 @@
set -e
duplicity \
$1 \
--asynchronous-upload \
--log-file /root/duplicity.log \
--name $BACKUP_NAME \

View File

@ -33,6 +33,11 @@ if [ -n "$CRON_SCHEDULE" ]; then
echo "$CRON_SCHEDULE source /env.sh && /backup.sh 2>> /cron.log" >> /crontab.conf
echo "Backups scheduled as $CRON_SCHEDULE"
if [ -n "$FULL_CRON_SCHEDULE" ]; then
echo "$FULL_CRON_SCHEDULE source /env.sh && /backup.sh full 2>> /cron.log" >> /crontab.conf
echo "Full backup scheduled as $VERIFY_CRON_SCHEDULE"
fi
if [ -n "$VERIFY_CRON_SCHEDULE" ]; then
echo "$VERIFY_CRON_SCHEDULE source /env.sh && /verify.sh 2>> /cron.log" >> /crontab.conf
echo "Verify scheduled as $VERIFY_CRON_SCHEDULE"

View File

@ -6,6 +6,6 @@ duplicity restore \
--log-file /root/duplicity.log \
--name $BACKUP_NAME \
$OPT_ARGUMENTS \
$@ \
$BACKUP_DEST \
$PATH_TO_BACKUP