feat: run in cron or one-shot mode depending if KOPIA_CRON_SCHEDULE is set
This commit is contained in:
parent
2be4717780
commit
62569d9abf
2 changed files with 17 additions and 10 deletions
|
@ -3,7 +3,7 @@ FROM kopia/kopia
|
|||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y cron && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG KOPIA_CRON_SCHEDULE="*/30 * * * *"
|
||||
ARG KOPIA_CRON_SCHEDULE
|
||||
ENV KOPIA_CRON_SCHEDULE ${KOPIA_CRON_SCHEDULE}
|
||||
|
||||
ARG KOPIA_USERNAME
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z ${KOPIA_CRON_SCHEDULE} ]];
|
||||
then
|
||||
echo "Running in one-shot mode"
|
||||
|
||||
/run-backup.sh
|
||||
else
|
||||
CRONTAB=/etc/cron.d/kopia-backup
|
||||
|
||||
printenv > /etc/environment
|
||||
|
@ -12,3 +18,4 @@ crontab ${CRONTAB}
|
|||
|
||||
touch /var/log/kopia-backup.log
|
||||
cron && tail -f /var/log/kopia-backup.log
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue