Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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 Crontab抛出错误_Ruby On Rails_Ruby_Crontab - Fatal编程技术网

Ruby on rails Crontab抛出错误

Ruby on rails Crontab抛出错误,ruby-on-rails,ruby,crontab,Ruby On Rails,Ruby,Crontab,我在crontab中使用了下面的命令,当我在终端中运行这个命令时,它工作正常,但是当我在crontab中运行这个命令时,我得到了以下错误 * * * * * cd /home/path/application && RAILS_ENV=development ./bundle exec rake namespacefolder:rake_file 错误: bundler: command not found: rake Install missing gem executa

我在crontab中使用了下面的命令,当我在终端中运行这个命令时,它工作正常,但是当我在crontab中运行这个命令时,我得到了以下错误

  * * * * * cd /home/path/application && RAILS_ENV=development ./bundle exec rake namespacefolder:rake_file
错误:

bundler: command not found: rake
Install missing gem executables with `bundle install`

有人请帮忙。

如果无法用bundle解决问题,请尝试使用此选项

* * * * * /bin/bash -l -c "cd ~/home/path/application && RAILS_ENV=development bundle exec rake namespacefolder:rake_file"
/bin/bash

指定用于执行命令的程序

-c

处理选项后,从第一个非选项参数读取并执行命令,然后退出。所有剩余的参数都将指定给位置参数,从$0开始

-l

让这个shell看起来像是直接被登录名调用的一样。当shell是交互式的时,这相当于使用“exec-lbash”启动登录shell。当shell不是交互式的时,将执行登录shell启动文件。”execbash-l或execbash--login将用bash登录shell替换当前shell。有关登录shell的特殊行为的描述,请参见Bash启动文件


请参阅此文档

如果无法通过捆绑解决,请尝试此文档

* * * * * /bin/bash -l -c "cd ~/home/path/application && RAILS_ENV=development bundle exec rake namespacefolder:rake_file"
/bin/bash

指定用于执行命令的程序

-c

处理选项后,从第一个非选项参数读取并执行命令,然后退出。所有剩余的参数都将指定给位置参数,从$0开始

-l

让这个shell看起来像是直接被登录名调用的一样。当shell是交互式的时,这相当于使用“exec-lbash”启动登录shell。当shell不是交互式的时,将执行登录shell启动文件。”execbash-l或execbash--login将用bash登录shell替换当前shell。有关登录shell的特殊行为的描述,请参见Bash启动文件


请参阅本文档

Cron只向作业传递最小的环境变量集。瞧

为bash添加-lc选项,以便cron执行,以使用登录环境并在crontab顶部设置环境路径

PATH=$PATH:/usr/bin:/bin:/usr/local/bin
* * * * * /bin/bash -lc "cd ~/home/path/application && RAILS_ENV=development bundle exec rake namespacefolder:rake_file"

Cron只向作业传递最小的环境变量集。瞧

为bash添加-lc选项,以便cron执行,以使用登录环境并在crontab顶部设置环境路径

PATH=$PATH:/usr/bin:/bin:/usr/local/bin
* * * * * /bin/bash -lc "cd ~/home/path/application && RAILS_ENV=development bundle exec rake namespacefolder:rake_file"

什么措辞可能比bundler已经给你的更清楚?使用
bundle Install
安装缺少的gem可执行文件。与
bundler
已经提供给您的内容相比,什么措辞可能更清楚?使用
捆绑安装
安装缺少的gem可执行文件。