每次我重新启动一个 linux 机器时,我都必须运行rails s以在 dev env 中启动一个 rails 应用程序。
有没有办法在linux重新启动时自动启动给定的rails应用程序?
我认为该解决方案接近于在生产环境中运行应用程序。
我从未在生产站点中运行过应用程序。
更新 1
我在谷歌上搜索了更多关于这个问题的信息,发现了一些离我很近的东西 我怎样才能让“rc.local”在启动时运行?.
我的/etc/rc/local:
#!/bin/sh -e
#
# 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.
/home/askar/.rvm/rubies/ruby-2.1.2/bin/ruby /home/askar/work/rails/smn/bin/rails s
exit 0
$ ls -al /etc/rc.local
-rwxr-xr-x 1 root root 423 Jul 23 12:41 /etc/rc.local
我能够运行:
$/etc/rc.local &
但是当我尝试运行以便在下次启动时自动启动时:
sudo /etc/init.d/rc.local start
它给了我错误:
Could not find rake-10.2.1 in any of the sources
Run `bundle install` to install missing gems.