Our old solution for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+.
We will instead use the whenever gem Show archive.org snapshot .
"Whenever" works just like "craken", by putting your rake tasks into the server's cron table. Everything seems to work just like we need it.
Installation for new projects
- 
Add "whenever" to your Gemfile:group :deploy do gem 'whenever', require: false end
- 
Add it to your config/deploy.rb:
 For Capistrano 2set :application, 'PROJECT_NAME' # might be already set set :whenever_command, "bundle exec whenever" require 'whenever/capistrano'Note that "whenever" will not use a :cronrole, but instead default to run cronjobs on the:dbserver. That's just fine for us.For Capistrano 3 set :application, 'PROJECT_NAME' # might be already set set :whenever_roles , [:cron] set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }Note that "whenever" will now use a :cronrole for all whenever tasks without a specific role provided in the attributeroles:
- 
Add to your Capfile(For Capistrano 3 only):require 'whenever/capistrano'
- 
Run b wheneverize.
- 
Edit config/schedule.rb, for exampleevery 15.minutes, roles: [:cron] do rake "makandra_de_website:update_tweet_cache" end
- 
You can check the crontab that would be written by running b whenever. This does not change anything.
Migration from craken
Do all of the above, and also
- Remove all blocks and hooks belonging to craken from your config/deploy.rb.
- Delete vendor/plugins/craken.
- Check if you have lib/tasks/craken.rb. If so, delete that, too.
- Make sure you have moved all cronjobs from config/craken/raketabtoconfig/schedule.rb. Then delete the first file.
- 
After the first deploy: Update the crontab by logging in on the server and run crontab -e. Remove the lines added by "craken" (they are clearly marked by a comment).