Example implementation of cron jobs on Docker/Aptible
git clone https://github.com/aptible/docker-cron-example
cd docker-cron-example/
make run
The example will print "aptible/docker-cron-example" once every minute.
To include within an Aptible app, copy the three body lines of the Dockerfile to your own Dockerfile:
RUN apt-get -y install rsyslog
ADD files/etc/crontab /etc/crontab
RUN touch /var/log/cron.log
Then, copy files/etc/crontab to your own repo, replacing echo aptible/docker-cron-example
with your own task, and * * * * *
with your own desired job schedule.
Finally, add an entry in your Procfile for the new cron
process:
cron: rsyslogd && cron && tail -f /var/log/syslog /var/log/cron.log
MIT License, see LICENSE for details.
Copyright (c) 2014 Aptible and contributors.