Heroku offer's a pretty nifty scheduler add-on for running jobs on your app at scheduled time intervals, much like cron in a traditional server environment. If you ever need to create something similar in a non-Heroku environment, here's how using whenever.
First create a simple Ruby on Rails application. If you're not familiar with creating a Rails app, check out this tutorial
rails _5.0.1_ new cron_job --api -c -m -O -T -d postgresql
Step 2 - Install Whenever
Install the whenever gem for cron jobs. Place this within your
gem 'whenever', :require => false
Then install the gems.
Step 3 - Run Whenever
Run this command within your terminal. This will create a new file within
Step 4 - Configure Whenever
Add a scheduled to
every :day, :at => '12:20pm' do rake 'orders:cleanup' end
Step 5 - Finalize your schedule
It will set the properly generated config le to the cron config.