tags:

views:

497

answers:

2

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?

+1  A: 

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/.

Lucas Jones
+1  A: 

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.

Arto Bendiken
It seems they're rate-limiting this to prevent abuse. Be aware. Needless to say, you should probably not use this for a production machine... :)
avocade
avocade, that's good to know. Do you have a link to more information about the rate-limiting?
Arto Bendiken