Files
sqlite-backup-s3/scripts/entrypoint.sh
T
vasyansk 5646ecd6dd
docker-build / Build image (push) Failing after 6s
fix cron after first run + add hc
2026-09-01 11:00:36 +07:00

23 lines
812 B
Bash

#!/bin/sh
set -e
# crond runs jobs with a bare environment (HOME/PATH/SHELL only), so the
# container env is dumped here and sourced back by backup.sh on every run.
ENV_FILE=/tmp/container.env
export -p | grep -v -E "^export (PWD|SHLVL|OLDPWD|_)=" > "$ENV_FILE"
chmod 600 "$ENV_FILE"
# Create crontab in a writable location and set proper permissions
mkdir -p /tmp/crontabs
echo "${CRONTAB:-"0 * * * *"} /scripts/backup.sh --from-cron >> /proc/1/fd/1 2>&1" > /tmp/crontabs/root
chmod 644 /tmp/crontabs/root
echo "[entrypoint] schedule: ${CRONTAB:-"0 * * * *"} (TZ=${TZ:-UTC})"
# Run initial backup (do not abort the container if it fails)
/scripts/backup.sh || echo "[entrypoint] initial backup failed, continuing to crond"
# Start crond in foreground with debug output
exec crond -f -c /tmp/crontabs -d 0