This commit is contained in:
+3
-1
@@ -7,6 +7,8 @@ LABEL "repository"="https://github.com/ttionya/vaultwarden-backup" \
|
||||
COPY scripts/*.sh /app/
|
||||
|
||||
RUN chmod +x /app/*.sh \
|
||||
&& apk add --no-cache bash sqlite p7zip heirloom-mailx tzdata
|
||||
&& apk add --no-cache bash heirloom-mailx p7zip sqlite supercronic tzdata \
|
||||
&& ln -sf /tmp/localtime /etc/localtime \
|
||||
&& mkdir -m 777 /bitwarden
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
@@ -37,16 +37,13 @@ if [[ "$1" == "restore" ]]; then
|
||||
fi
|
||||
|
||||
function configure_timezone() {
|
||||
if [[ ! -f /etc/localtime || ! -f /etc/timezone ]]; then
|
||||
cp -f "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
|
||||
echo "${TIMEZONE}" > /etc/timezone
|
||||
fi
|
||||
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /tmp/localtime
|
||||
}
|
||||
|
||||
function configure_cron() {
|
||||
local FIND_CRON_COUNT=$(crontab -l | grep -c 'backup.sh')
|
||||
if [[ ${FIND_CRON_COUNT} -eq 0 ]]; then
|
||||
echo "${CRON} bash /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
|
||||
local FIND_CRON_COUNT="$(grep -c 'backup.sh' "${CRON_CONFIG_FILE}" 2> /dev/null)"
|
||||
if [[ "${FIND_CRON_COUNT}" -eq 0 ]]; then
|
||||
echo "${CRON} bash /app/backup.sh" >> "${CRON_CONFIG_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -56,4 +53,4 @@ configure_timezone
|
||||
configure_cron
|
||||
|
||||
# foreground run crond
|
||||
crond -l 2 -f
|
||||
supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
ENV_FILE="/.env"
|
||||
CRON_CONFIG_FILE="${HOME}/crontabs"
|
||||
BACKUP_DIR="/bitwarden/backup"
|
||||
RESTORE_DIR="/bitwarden/restore"
|
||||
RESTORE_EXTRACT_DIR="/bitwarden/extract"
|
||||
|
||||
Reference in New Issue
Block a user