Added option to set the target folder backup

This commit is contained in:
Marcio Zimbres
2023-12-07 14:02:36 -03:00
parent c2ae895ed8
commit bf2dabd2c7
4 changed files with 12 additions and 1 deletions

View File

@@ -2,6 +2,9 @@
## Unreleased
### Added
* Option to set the target folder backup
## v1.3.2 (restic 0.16.0)
### Changed

View File

@@ -35,6 +35,7 @@ ENV OS_PASSWORD=""
ENV OS_REGION_NAME=""
ENV OS_INTERFACE=""
ENV OS_IDENTITY_API_VERSION=3
ENV BACKUP_SOURCES=""
# openshift fix
RUN mkdir /.cache && \

View File

@@ -142,6 +142,7 @@ The container is set up by setting [environment variables](https://docs.docker.c
* `OS_REGION_NAME` - Optional. When using restic with OpenStack Swift container.
* `OS_INTERFACE` - Optional. When using restic with OpenStack Swift container.
* `OS_IDENTITY_API_VERSION` - Optional. When using restic with OpenStack Swift container.
* `BACKUP_SOURCES` - Optional. Set the folder that will be backed up.
## Volumes

View File

@@ -4,6 +4,12 @@ lastLogfile="/var/log/backup-last.log"
lastMailLogfile="/var/log/mail-last.log"
lastMicrosoftTeamsLogfile="/var/log/microsoft-teams-last.log"
if [ -n "$BACKUP_SOURCES" ]; then
backupSources="$BACKUP_SOURCES"
else
backupSources="/data"
fi
copyErrorLog() {
cp ${lastLogfile} /var/log/backup-error-last.log
}
@@ -31,7 +37,7 @@ logLast "RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}"
logLast "AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}"
# Do not save full backup log to logfile but to backup-last.log
restic backup /data ${RESTIC_JOB_ARGS} --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> ${lastLogfile} 2>&1
restic backup ${backupSources} ${RESTIC_JOB_ARGS} --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> ${lastLogfile} 2>&1
backupRC=$?
logLast "Finished backup at $(date)"
if [[ $backupRC == 0 ]]; then