Rails cron whenever, bundle: command not found

后端 未结 13 1495
星月不相逢
星月不相逢 2020-12-04 17:57

I am trying to use whenever to execute a rake task onces a day. Im getting this error

/bin/bash: bundle: command not found
/home/app/.rvm/rubies/ruby-1.9.2-p         


        
相关标签:
13条回答
  • 2020-12-04 18:30

    You can try below solution which I found while googling and that works for me finally....hope that should work with you.

    I implemented and tested the same on production make sure that to change environment accordingly -

    set :output, "{your path on the server}/log/cron_log.log"
     set :environment, :production
     env :PATH, ENV['PATH']
     job_type :rbenv_rake, %q!eval "$(rbenv init -)"; cd :path && :environment_variable=:environment bundle exec rake :task --silent :output!
    

    Best luck, This issue occurred after 3 years as I was using before just simple what given on the gem documentation on production.

    I'm using Ruby 2.x and Rails 4.2 with whenever 0.9.4 latest version. It should work with earlier version as well, if the nature of the issue is same.

    thank you.

    0 讨论(0)
提交回复
热议问题