mirror of
https://github.com/ViViDboarder/docker-restic-cron.git
synced 2024-11-21 20:56:36 +00:00
Add schedule for full backups and restore args
This commit is contained in:
parent
6c28a96a22
commit
917a4577c5
@ -20,6 +20,7 @@ ENV PASSPHRASE="Correct.Horse.Battery.Staple"
|
|||||||
|
|
||||||
# Cron schedules
|
# Cron schedules
|
||||||
ENV CRON_SCHEDULE=""
|
ENV CRON_SCHEDULE=""
|
||||||
|
ENV FULL_CRON_SCHEDULE=""
|
||||||
ENV VERIFY_CRON_SCHEDULE=""
|
ENV VERIFY_CRON_SCHEDULE=""
|
||||||
|
|
||||||
ADD backup.sh /
|
ADD backup.sh /
|
||||||
|
@ -19,6 +19,7 @@ ENV PASSPHRASE="Correct.Horse.Battery.Staple"
|
|||||||
|
|
||||||
# Cron schedules
|
# Cron schedules
|
||||||
ENV CRON_SCHEDULE=""
|
ENV CRON_SCHEDULE=""
|
||||||
|
ENV FULL_CRON_SCHEDULE=""
|
||||||
ENV VERIFY_CRON_SCHEDULE=""
|
ENV VERIFY_CRON_SCHEDULE=""
|
||||||
|
|
||||||
ADD backup.sh /
|
ADD backup.sh /
|
||||||
|
4
Makefile
4
Makefile
@ -1,9 +1,11 @@
|
|||||||
.PHONY: build-x86 build-arm build-all
|
.PHONY: build-x86 build-arm build-all test
|
||||||
|
|
||||||
DOCKER_TAG ?= docker-duplicity-cron
|
DOCKER_TAG ?= docker-duplicity-cron
|
||||||
|
|
||||||
default: build-x86
|
default: build-x86
|
||||||
|
|
||||||
|
test: test-x86
|
||||||
|
|
||||||
build-x86:
|
build-x86:
|
||||||
docker build -f ./Dockerfile.ubuntu -t $(DOCKER_TAG):ubuntu .
|
docker build -f ./Dockerfile.ubuntu -t $(DOCKER_TAG):ubuntu .
|
||||||
|
|
||||||
|
@ -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_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|
|
|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")|
|
|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|
|
|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|
|
|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|
|
|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|
|
|PASSPHRASE|Correct.Horse.Battery.Staple|Passphrase to use for GPG|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
duplicity \
|
duplicity \
|
||||||
|
$1 \
|
||||||
--asynchronous-upload \
|
--asynchronous-upload \
|
||||||
--log-file /root/duplicity.log \
|
--log-file /root/duplicity.log \
|
||||||
--name $BACKUP_NAME \
|
--name $BACKUP_NAME \
|
||||||
|
@ -33,6 +33,11 @@ if [ -n "$CRON_SCHEDULE" ]; then
|
|||||||
echo "$CRON_SCHEDULE source /env.sh && /backup.sh 2>> /cron.log" >> /crontab.conf
|
echo "$CRON_SCHEDULE source /env.sh && /backup.sh 2>> /cron.log" >> /crontab.conf
|
||||||
echo "Backups scheduled as $CRON_SCHEDULE"
|
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
|
if [ -n "$VERIFY_CRON_SCHEDULE" ]; then
|
||||||
echo "$VERIFY_CRON_SCHEDULE source /env.sh && /verify.sh 2>> /cron.log" >> /crontab.conf
|
echo "$VERIFY_CRON_SCHEDULE source /env.sh && /verify.sh 2>> /cron.log" >> /crontab.conf
|
||||||
echo "Verify scheduled as $VERIFY_CRON_SCHEDULE"
|
echo "Verify scheduled as $VERIFY_CRON_SCHEDULE"
|
||||||
|
@ -6,6 +6,6 @@ duplicity restore \
|
|||||||
--log-file /root/duplicity.log \
|
--log-file /root/duplicity.log \
|
||||||
--name $BACKUP_NAME \
|
--name $BACKUP_NAME \
|
||||||
$OPT_ARGUMENTS \
|
$OPT_ARGUMENTS \
|
||||||
|
$@ \
|
||||||
$BACKUP_DEST \
|
$BACKUP_DEST \
|
||||||
$PATH_TO_BACKUP
|
$PATH_TO_BACKUP
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user