gpt4 book ai didi

bundle: command not found when run script(捆绑包:运行脚本时未找到命令)

转载 作者:bug小助手 更新时间:2023-10-24 19:46:26 28 4
gpt4 key购买 nike



I want to create a script to send remind expire issue in redmine. When I run this script by manual, it's ok. But when I create a crontab to run it, it did not run and show the error log: "bundle: command not found".
My script:

我想创建一个脚本发送提醒到期问题在Redmine。当我手动运行这个脚本时,它是可以的。但是,当我创建一个crontabb来运行它时,它没有运行,并显示错误日志:“Bundle:Command Not Found”。我的剧本:


#!/bin/bash
cd /opt/redmine-5.0.2
bundle exec rake redmine:send_reminders days=1 RAILS_ENV="production"

I try to add full path of bundle to script

我尝试将包的完整路径添加到脚本


#!/bin/bash
cd /opt/redmine-5.0.2
/usr/local/rvm/gems/ruby-3.0.0/bin/bundle exec rake redmine:send_reminders days=1 RAILS_ENV="production"```

It shown that

bundler: failed to load command: rake (/usr/local/rvm/gems/ruby-3.0.0/bin/rake)
/usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/spec_set.rb:87:in `block in materialize': Could not find rake-13.0.6 in any of the sources (Bundler::GemNotFound)
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/spec_set.rb:81:in `map!'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/spec_set.rb:81:in `materialize'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/definition.rb:175:in `specs'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/definition.rb:245:in `specs_for'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/definition.rb:227:in `requested_specs'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:91:in `block in definition_method'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/runtime.rb:20:in `setup'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler.rb:149:in `setup'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/setup.rb:20:in `block in <top (required)>'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/ui/shell.rb:136:in `with_level'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/ui/shell.rb:88:in `silence'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:61:in `require_relative'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:61:in `kernel_load'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:497:in `exec'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:49:in `block in <top (required)>'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:37:in `<top (required)>'
from /usr/local/rvm/gems/ruby-3.0.0/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-3.0.0/bin/bundle:23:in `<main>'

Thanks for your support.

更多回答

Tell me if stackoverflow.com/questions/39037735/… is a good solution. (a quick search on SO web site)...

告诉我如果Stackoverflow.com/Questions/39037735/…是一个很好的解决方案。(在SO网站上快速搜索)...

Thanks Gilles Quénot, I try to add source "/usr/local/rvm/scripts/rvm" into my script, and it's oke now, I also dont need to add PATH.

感谢Gilles quénot,我尝试在我的脚本中添加源代码“/usr/local/rvm/脚本/rvm”,现在它是OK的,我也不需要添加路径。

优秀答案推荐
更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com