From ef841499f752f48876021ef99a8e3147e33e5a44 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 1 Feb 2020 22:04:44 +0100 Subject: [PATCH] Added ftp backup script --- Dockerfile | 5 ++++- prefilebackup | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 prefilebackup diff --git a/Dockerfile b/Dockerfile index c2dc76f..38c02c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,10 @@ RUN TF=`mktemp` &&\ EXPOSE 35621/TCP 35622/UDP 35623/TCP +COPY prefilebackup /usr/local/etc/urbackup/ +RUN chmod 0700 /usr/local/etc/urbackup/prefilebackup + WORKDIR /app -COPY run.sh /app +COPY run.sh /app/ CMD ["sh", "run.sh"] diff --git a/prefilebackup b/prefilebackup new file mode 100644 index 0000000..f450220 --- /dev/null +++ b/prefilebackup @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +if [[ -z "$DO_FTP_BACKUP" ]]; then + exit 0 +fi + +# DISTANT DIRECTORY +REMOTE_DIR="/" + +#LOCAL DIRECTORY +LOCAL_DIR="/backup" + +# RUNTIME! +echo +echo "Starting download $REMOTE_DIR from $FTP_HOST to $LOCAL_DIR" +date + +lftp -u "$FTP_USER","$FTP_PASSWORD" $FTP_HOST <