I've seen that Heroku charges $15/mo to run Delayed Job, and $3/mo to run cron tasks daily. Is it possible to skip that entirely and run my own cron tasks manually? Or are they somehow figuring out that I'm running cron tasks?
Cron To Go is an add-on created for Heroku users to run scheduled jobs based on one-off dynos using cron expressions. Cron To Go combines the simplicity of using cron to schedule jobs with the scale and elasticity of the cloud.
Reliable delivery Heroku Scheduler is a free add-on, but it doesn't guarantee that jobs will be executed at their scheduled time, or at all for that matter. While it is rare, the possibility that a job may be skipped or run twice does exist.
Click on the Heroku Scheduler Add-on from the Resources tab on the Dashboard or run the command heroku addons:open scheduler from the CLI. Click edit on your scheduled job (usually indicated with a pencil). Under Run Command, look for a dropdown that allows you to select the dyno plan. Save Job.
I'm not entirely sure what you mean by "run my own cron tasks manually". For cron specifically, you need access to crontab
, which they can control, as they're their servers. If you have another way of doing it, it would probably be fine, but bear in mind that your app is not tied to a specific server when running under Heroku, and that the server will change between executions.
Also, unless they've changed it since last time I checked, you can run daily cron tasks for free, but hourly costs $3/mo.
EDIT: Yes, daily crons are free. See http://addons.heroku.com/.
If you install the Heroku gem on your computer, you can then run your cron tasks manually as follows:
$ heroku rake cron (in /disk1/home/slugs/xxxxxx_aa515b2_6c4f/mnt) Running cron at 2010/04/25 10:28:54...
This will execute the exact same code as Heroku's daily/hourly cron add-on does; that is, for this to work, your application must have a Rakefile with a cron
task, for example:
desc "Runs cron maintenance tasks." task :cron do puts "Running cron at #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}..." # TODO: your cron code goes here end
Now, just add the heroku rake cron
command to a crontab on any Unix server of yours, or even directly to your personal computer's crontab
if you're running Linux or Mac OS X, and you can be scheduling cron jobs for your Heroku application as you please and without being charged for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With