#!/bin/sh set -eu : "${CRON:=0 3 * * *}" # busybox crond only loads crontab files owned by uid 0, and before every job # it drops to the crontab's user with initgroups()/setgid()/setuid(). So this # container has to run as root — the compose file sets user: '0:0' anyway, # because Seafile writes some block files 0600 root:root. if [ "$(id -u)" != "0" ]; then echo "entrypoint: crond needs root (crontab files must be owned by uid 0)" >&2 exit 78 fi # The rootfs is read-only, so the generated crontab lives on the tmpfs. CRON_DIR=/tmp/crontabs mkdir -p "$CRON_DIR" # MAILTO= (empty) keeps job output on crond's own stdout/stderr, i.e. the # container log — the passthrough supercronic used to provide. { echo 'MAILTO=' printf '%s /usr/local/bin/seafile-backup\n' "$CRON" } > "$CRON_DIR/root" chmod 0600 "$CRON_DIR/root" exec crond -f -c "$CRON_DIR"