javan / javan/whenever

How do I "namespace" the crontab entries?

Open
#828 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
8.9k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

The documentation here (for Capistrano3) says to do this at the bottom of deploy.rb.

set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }

I've done this, but I do not understand how to "namespace the crontab entries." Can someone give me an example of how to do modify my schedule.rb to reflect this "namespace?" (I'm trying to get my whenever entries to NOT run in staging.)

Sorry if this is a stupid question, but I've tried about a half dozen things to make this work, but none of them seem to be up to date, and I can't find an example of this approach.

I have this, but it still creates crontab entries in staging with cap staging whenever:update_crontab:

set :output, "#{path}/log/whenever.log"
env "MAILTO", "david.krider@company.com"

namespace :widget_whammer_production do

  every 1.week do
    runner "FeaturizationNotificationJob.perform_now"
  end

end

Additionally, when doing cap production deploy, I get this error:

/var/www/apps/widget_whammer/shared/bundle/ruby/2.5.0/gems/whenever-1.0.0/lib/whenever/job_list.rb:37:in `method_missing': undefined method `namespace'… from config/schedule.rb:25:in `initialize'

So something is different between cap <stage> deploy vs. cap <stage> whenever:<command>.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Capistrano3 documentation referenced in the issue, then compare its deploy.rb example with config/schedule.rb and the whenever:update_crontab command. Clarify the difference between cap deploy and cap whenever:, and document a working schedule.rb example that explains what “namespace” means and how staging entries should be handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.