Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Linux中的Shell脚本被中止!未找到Rakefile,但其工作方式不是从shell运行_Ruby On Rails - Fatal编程技术网

Ruby on rails Linux中的Shell脚本被中止!未找到Rakefile,但其工作方式不是从shell运行

Ruby on rails Linux中的Shell脚本被中止!未找到Rakefile,但其工作方式不是从shell运行,ruby-on-rails,Ruby On Rails,因此,我尝试运行此脚本,该脚本在提示符下运行良好,但在shell脚本中失败: rake redmine:email:receive_imap unknown_user=accept no_permission_check=1 RAILS_ENV="production" host=mail.domain.org port=993 username=helpdesk@domain.org password=XXXXXX ssl=1 move_on_success=Processed move_on

因此,我尝试运行此脚本,该脚本在提示符下运行良好,但在shell脚本中失败:

rake redmine:email:receive_imap unknown_user=accept no_permission_check=1 RAILS_ENV="production" host=mail.domain.org port=993 username=helpdesk@domain.org password=XXXXXX ssl=1 move_on_success=Processed move_on_failure=Failed project=emailsupport tracker=Support subject=EmailSupport status=New
下面是我试图用sh/opt/redmine/scripts/redmine-rake-email.sh运行的.sh文件,我的rake被中止了!找不到Rakefile,我正在/opt/redmine目录下运行它,该目录中确实有一个Rakefile

实际上我的脚本现在是这样的。还是不行

SHELL=/bin/bash
PATH=$PATH:/opt/redmine:/usr/local/bin:/usr/local/rvm/gems/ruby-1.8.7-p334/bin
cd /opt/redmine 
rake redmine:email:receive_imap unknown_user=accept no_permission_check=1 RAILS_ENV="production" host=mail.domain.org port=993 username=helpdesk@domain.org password=XXXXXX ssl=1 move_on_success=Processed move_on_failure=Failed project=emailsupport tracker=Support subject=EmailSupport status=New
以下是我运行echo$PATH时的路径:

/usr/local/rvm/gems/ruby-1.8.7-p334/bin:/usr/local/rvm/gems/ruby-1.8.7-p334@global/bin:/usr/local/rvm/rubies/ruby-1.8.7-p334/bin:/usr/local/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/redmine:/usr/local/bin:/usr/local/rvm/gems/ruby-1.8.7-p334/bin

我被卡住了,不知道出了什么问题。谢谢您的时间。

rake

之后将
-f/opt/redmine/Rakefile
添加到rake参数中,脚本中的路径行中是否确实有空格?不,我肯定没有。我打这封信的时候不小心把它们放在上面了。谢谢塔斯社,我这么做了,现在上面写着“rake中止了!”!未配置开发数据库“”。为什么它会提到开发?好吧,读到rake默认为开发,所以我把RAILS_ENV=production放在后面,现在我让rake中止了!连接被拒绝-连接(2)。我就是不能休息。:)这正在起作用。在该脚本中,我删除了路径设置,并且rake命令最终包含一个换行符。也删除了它,现在它正在工作。感谢塔斯社让我加入-f/opt/redmine/Rakefile。这实际上解决了我的问题。