Whenever not working with RVM
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.9k
- Forks
- 715
- PR merge metrics
- No merged PRs in 30d
Description
I'am trying to run a simple cron task in my local machine.
My schedule.rb is the following
set :output, 'log/cron_log.log'
every 1.minutes do
rake 'tris:export:users'
end
By executing whenever --update-crontab --set environment=development
The cron output results in
# Begin Whenever generated tasks for: /Users/apellizz/development/four_gifters/config/schedule.rb
* * * * * /bin/bash -l -c 'cd /Users/apellizz/development/fg && RAILS_ENV=development bundle exec rake tris:export:users --silent >> log/cron_log.log 2>&1'
# End Whenever generated tasks for: /Users/apellizz/development/fg/config/schedule.rb
and the cron_log.log says
/bin/bash: bundle: command not found
After looking for a solution i found that RVM may cause some issues so i've updated my schedule.rb like
ENV.each { |k, v| env(k, v) }
set :output, 'log/cron_log.log'
every 1.minutes do
rake 'tris:export:users'
end
But now the log output is
Rails 5 requires Ruby 2.2.2 or newer.
You're running
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
Please upgrade to Ruby 2.2.2 or newer to continue.
Even if the rvm current output in my project folder is ruby-2.4.0.
Any suggestions?
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 the shown schedule.rb and the generated crontab entry, then compare the Ruby, RVM, and bundle environment available to cron with the interactive shell. Reproduce the task from cron and consider it resolved when the generated command uses the intended Ruby version and runs the rake task without the shown bundle or Ruby-version errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100