After using thin or rbenv, many friends found that rails could not be started happily with linux startup.
Remember the following points:
1. Make the PATH contain the rbenv PATH
2. Check the/var/logs/boot. log file during debugging.
The specific process is as follows:
1. Create a file/etc/init. d/start_rails_servers: (note that the first few lines of the following code are indispensable)
#! /Bin/bash
Source/root/. bashrc
Export PATH =/root /. rbenv/shims:/root /. rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games
Echo "path is :"
Echo $ PATH
Cd/opt/app/upload. tuling. siwei. tech/& bundle exec thin restart-C config/thin. yml
2. Add executable permissions to the script
$ Chmod + x/etc/init. d/start_rails_servers
3. Update the linux startup code
$ Update-rc.d start_rails_servers ULTS
Now, when linux is started, the rails application will be automatically started.