#!/bin/bash

printenv >> /etc/environment
envsubst < /opt/backup/rsync.template > /opt/backup/rsync.sh
if [ "$NO_RSYNC" == 1 ]; then
  sed -i '/rsync.sh/d' ./crontab
  rm /opt/backup/rsync.*
fi
crontab ./crontab && touch /var/log/cron.log && cron && tail -f /var/log/cron.log
