Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.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 RubyonRails:重新启动时如何使“rc.local”运行_Ruby On Rails_Ubuntu 14.04 - Fatal编程技术网

Ruby on rails RubyonRails:重新启动时如何使“rc.local”运行

Ruby on rails RubyonRails:重新启动时如何使“rc.local”运行,ruby-on-rails,ubuntu-14.04,Ruby On Rails,Ubuntu 14.04,这是我的rc中的内容 sh /var/www/test.sh exit 0 这就是我测试的内容 cd /home/jeff/test && rails s Puma -d 问题是找不到rmv,ruby在usr/bin1.9.3中。我的ruby正确版本是2.1.5。我如何解决这个问题 也许我应该向test.sh添加路径,但我不知道如何让它识别ruby 2.1.5的路径 我自己找到了答案。 在rc.local文件中,我写了以下内容 #!/bin/bash # # rc.lo

这是我的rc中的内容

sh /var/www/test.sh   
exit 0
这就是我测试的内容

cd /home/jeff/test && rails s Puma -d
问题是找不到rmv,ruby在usr/bin1.9.3中。我的ruby正确版本是2.1.5。我如何解决这个问题

也许我应该向test.sh添加路径,但我不知道如何让它识别ruby 2.1.5的路径

我自己找到了答案。 在rc.local文件中,我写了以下内容

#!/bin/bash
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
cd /home/jeff/thingspeak@
source /etc/profile.d/rvm.sh
source $(rvm 2.1.0 do rvm env --path)
rvm use 2.1.5
sh   /var/www/thingspeak@/rails.sh

exit 0