Whenever Cron With Multiple Projects On Server

capistrano, deployment, ruby-on-rails, whenever, whenever-capistrano

Solution

You'll want to namespace your projects or they'll overwrite each other when you deploy:

set :whenever_environment, defer { stage }
set :whenever_identifier, defer { "#{application}_#{stage}" }
require "whenever/capistrano"

Problem

I use whenever in my rails apps and deploy it with capistrano. The trouble is that since I use it only for one project there's no problem, but when I use whenever for more projects on the same server, everytime I deploy my project I destroy and recreate the cron file. I need that every project update it or append new instruction, to coexists on the same server. I simply deploy with deploy.rb ``` set :whenever_command, "bundle exec whenever" require "whenever/capistrano" ... after "deploy:create_symlink", "deploy:update_crontab" .... ``` Someone can teach me how can I do?

Original source