#!bin/sh echo "Starting container ..." restic snapshots rc=$? if [[ $rc != 0 ]]; then echo "Restic repository '${RESTIC_REPOSITORY}' does not exists. Running restic init." restic init fi echo "Setup backup cron job with cron expression BACKUP_CRON: ${BACKUP_CRON}" echo "${BACKUP_CRON} flock -n /tmp/backup.lockfile /bin/backup >> /var/log/cron.log 2>&1" > /var/spool/cron/crontabs/root echo "Setup check cron job with cron expression CHECK_CRON: ${CHECK_CRON}" echo "${CHECK_CRON} flock /tmp/backup.lockfile /bin/check >> /var/log/cron.log 2>&1" >> /var/spool/cron/crontabs/root cat /var/spool/cron/crontabs/root # Make sure the file exists before we start tail touch /var/log/cron.log # start the cron deamon crond echo "Container started." if [ -n "${RESTIC_BACKUPONSTART}" ]; then flock -n /tmp/backup.lockfile /bin/backup fi tail -fn0 /var/log/cron.log