5

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?

Muntasim
  • 6,689
  • 3
  • 46
  • 69
Nunzio Fiore
  • 245
  • 3
  • 14

2 Answers2

3

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"
joelparkerhenderson
  • 34,808
  • 19
  • 98
  • 119
0

With capistrano V3, in your deploy file:

set :whenever_identifier, ->{ "#{fetch(:application)}_namespace" }
Sidhannowe
  • 465
  • 5
  • 11