I have a Rails app deployed on Heroku with the Heroku scheduler add-on successfully working for daily jobs.
Now I want a weekly job, but the schedul
One approach would be the one of your 2nd bullet point:
activate the Heroku cron add-on, and add a cron.rake task in app/lib/tasks
Activate the Heroku scheduler add-on, and add a scheduler.rake task in app/lib/tasks
task :your_weekly_task=> :environment do
if Time.now.friday? # previous answer: Date.today.wday == 5
#do something
end
end
You even have the luxury of defining the day you want your task to run ;o) (5 is for Friday)
EDIT: by the way, Cron is deprecated and Heroku recommends switching to their Scheduler add-on. This doesn't change the approach for a weekly job though.
EDIT2: adjustments to my answer based on feedback from sunkencity.