Rails cron whenever, bundle: command not found

后端 未结 13 1524
星月不相逢
星月不相逢 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:08

    After so many try outs the following seems to work

    Type the following from terminal

    1. Type crontab -e This opens the crontab for editing. You will see two lines as below:

      # cron clears out environment variables, but Rubber.root/script/rubber uses
      # "rvm do default" to run, so no longer any need to setup ruby env vars here,
      # all we need is PATH
      PATH=//bundle/ruby/1.9.1/bin:/usr/local/rvm/gems
      

      AND

      # Begin Whenever generated tasks for: /mnt/wamjoke-production/releases/20120912$
      PATH=//shared/bundle/ruby/1.9.1/bin:/usr/local/rvm/gems
      
    2. Comment out both lines beginning with PATH.

    Do the above step whenever you run "bundle exec whenever" command. And it works.

    No idea why PATH is misleading the environment.

提交回复
热议问题