How do I run scheduled tasks (cron jobs) on Enclave?
On Aptible, cron jobs run as another service associated with your app, defined in your app’s Procfile.
To illustrate, we’ve set up a GitHub repo with an example of how to add cron jobs to your app.
To summarize the GitHub example:
crontabfile to your repo, and install it at
/etc/crontabin your Docker image, by adding the following directive to your Dockerfile:
ADD files/etc/crontab /etc/crontab
Then, add a new
cronprocess to your Procfile, which just runs
cron -f. In the GitHub example, we run a special script,
start-cron.sh, in order to log the output of all cron jobs.
Another option for running scheduled tasks on Aptible is to use the Whenever gem. More on that approach over here.