Crontab doesn't work with Rails 7
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.9k
- Forks
- 715
- PR merge metrics
- No merged PRs in 30d
Description
Crontab is not working.
I have configured crontab with the settings below.
I ran whenever --update-crontab, but it is not working.
ruby 3.1.4
rails 7.0.8
#config/schedule.rb
set :output, "/log/cron_log.log"
every 2.minutes do
runner 'Article.update_content'
end
#app/models/article.rb
class Article < ApplicationRecord
class << self
def update_content
article = Article.first
content = article.content.to_i + 1
article.update content: content
end
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with config/schedule.rb and app/models/article.rb, then reproduce the whenever --update-crontab command using the listed Ruby and Rails versions. Check the generated cron entry and its log output; done means the scheduled runner executes every two minutes and updates Article content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100