I've read this post Whenever errors and tried to implement the recommendations to no avail. I'm still receiving '/bin/bash: bundle: command not found' error. On Amazon EC2.
我已经读过这篇文章,每当有错误并试图实施建议都无济于事。我仍然收到'/ bin / bash:bundle:command not found'错误。在Amazon EC2上。
which ruby
/usr/local/bin/ruby
which bundler
/usr/local/bin/bundler
schedule.rb
env :PATH, ENV['PATH']
require File.expand_path('../application', __FILE__)
set :output, "log/cron_log.log"
every 1.minutes do
rake "calculate:calculate"
end
crontab -e
-
-
-
-
- /bin/bash -l -c 'cd /srv/www/myapp/releases/20141022032959 && RAILS_ENV=development bundle exec rake calculate:calculate --silent >> log/cron_log.log 2>&1'
/ bin / bash -l -c'cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake calculate:calculate --silent >> log / cron_log.log 2>&1'
/ bin / bash -l -c'cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake calculate:calculate --silent >> log / cron_log.log 2>&1'
-
/ bin / bash -l -c'cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake calculate:calculate --silent >> log / cron_log.log 2>&1'
-
/ bin / bash -l -c'cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake calculate:calculate --silent >> log / cron_log.log 2>&1'
-
/ bin / bash -l -c'cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake calculate:calculate --silent >> log / cron_log.log 2>&1'
tail -f log/cron_log.log
tail -f log / cron_log.log
/bin/bash: bundle: command not found
When I copy the command out of crontab and run it directly, everything works fine (cd /srv/www/myapp/releases/20141022032959 && RAILS_ENV=development bundle exec rake calculate:calculate --silent >> log/cron_log.log 2>&1). It's the prepending of /bin/bash that's messing this up.
当我从crontab复制命令并直接运行它时,一切正常(cd / srv / www / myapp / releases / 20141022032959 && RAILS_ENV =开发包exec rake计算:calculate --silent >> log / cron_log.log 2> &1)。这是/ bin / bash的前置,这搞砸了这个。
How do I get schedule.rb / whenever gem to recognize correct PATH.
每当gem识别正确的PATH时,我如何获得schedule.rb /。
2 个解决方案
#1
13
Forget about PATH settings in cron files. Setting the PATH does not work.
忘记cron文件中的PATH设置。设置PATH不起作用。
Set the path to bundle explicitly in your config/schedule.rb
在config / schedule.rb中明确设置要捆绑的路径
set :bundle_command, "/usr/local/bin/bundle exec"
Edit: exec added so that task can run
编辑:添加exec以便任务可以运行
#2
0
If none of the above solution works this did it for me without any additional setup
如果以上解决方案都不起作用,那么在没有任何其他设置的情况下这样做了
rvm cron setup
This will include all the right paths for gems so you do this on your machine and you are good to go.
这将包括宝石的所有正确路径,因此您可以在您的机器上执行此操作,并且您很高兴。
#1
13
Forget about PATH settings in cron files. Setting the PATH does not work.
忘记cron文件中的PATH设置。设置PATH不起作用。
Set the path to bundle explicitly in your config/schedule.rb
在config / schedule.rb中明确设置要捆绑的路径
set :bundle_command, "/usr/local/bin/bundle exec"
Edit: exec added so that task can run
编辑:添加exec以便任务可以运行
#2
0
If none of the above solution works this did it for me without any additional setup
如果以上解决方案都不起作用,那么在没有任何其他设置的情况下这样做了
rvm cron setup
This will include all the right paths for gems so you do this on your machine and you are good to go.
这将包括宝石的所有正确路径,因此您可以在您的机器上执行此操作,并且您很高兴。