Skip to content

Commit

Permalink
cron working
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante Barba authored and Dante Barba committed Sep 17, 2020
1 parent 9f9f4f6 commit 3bcf1ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
14 changes: 2 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@ RUN apt-get update \
ADD cron.sh /usr/bin/cron.sh
RUN chmod +x /usr/bin/cron.sh

ADD ./crontab /etc/cron.d/cron-jobs
RUN chmod 0644 /etc/cron.d/cron-jobs

RUN touch /var/log/autoremove-torrents.log

RUN touch /var/log/cron.log

COPY config.example.yml config.yml

ENV OPTS ''
ENV OPTS '-c /app/config.yml'
ENV CRON '*/5 * * * *'

ENTRYPOINT ["/bin/sh", "/usr/bin/cron.sh"]





ENTRYPOINT ["/bin/sh", "/usr/bin/cron.sh"]
13 changes: 6 additions & 7 deletions cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
if [ -z "$CRON" ]
then
echo "INFO: No CRON setting found. Running autoremove once."
/usr/bin/autoremove-torrents $OPTS
/usr/local/bin/autoremove-torrents $OPTS
else
# Setup cron schedule
crontab -d
echo "$CRON /usr/bin/autoremove-torrents $OPTS >> /var/log/autoremove-torrents.log 2>&1" > /tmp/crontab.tmp
echo "$CRON /usr/local/bin/autoremove-torrents $OPTS >> /var/log/autoremove-torrents.log 2>&1" > /tmp/crontab.tmp
crontab /tmp/crontab.tmp
crontab -l
rm /tmp/crontab.tmp

# Start cron
echo "INFO: Starting crond ..."
echo "INFO: Starting cron ..."
touch /var/log/crond.log
crond -b -l 0 -L /var/log/crond.log
echo "INFO: crond started"
cron -f &
echo "INFO: cron started"
tail -F /var/log/crond.log /var/log/autoremove-torrents.log
fi
fi

0 comments on commit 3bcf1ca

Please sign in to comment.