I wrote a bash script to start thin server for two projects.
#! /bin/sh
cd /path/to/my/project_1
thin -e production -p 3000 --daemonize -s 10 start
Then placed it in /etc/init.d/start_thin. Gave it 755 permissions. Ran:
sudo update-rc.d start_thin defaults.
then
sudo reboot
Thin is not started. Thanks.
UPDATE:
After a long fight, I found this error which only happens when thin is started with /etc/init.d/thin:
Writing PID to tmp/pids/thin.3000.pid Using rails adapter /path/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/mysql2.so: [BUG] Segmentation fault ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
I guess now the only logical thing is to switch to the "normal" sql gem.
UPDATE 2:
I found this resource which helped me before, but can't help now.
UPDATE 3:
I reinstalled RVM using the quick install. Now when the script on bootup runs, I see in the log that a gem is missing: multi_json-1.1.0. I installed it and put in the Gemfile. Did not help. Still, when I execute the bash script manually - no problem. Only on bootup it complains about multi_json-1.1.0.
UPDATE 4:
Only on startup, thin's log file contains:
I don't understand why it uses 1.8 gems, when i have ruby 1.9.2 installed :-?
>> Writing PID to tmp/pids/thin.3000.pid
>> Using rails adapter
>> Exiting!
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:87:in `materialize': Could not find multi_json-1.1.0 in any of the sources (Bundler::GemNotFound)
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:81:in `map!'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:81:in `materialize'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:90:in `specs'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:135:in `specs_for'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/definition.rb:124:in `requested_specs'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/environment.rb:23:in `requested_specs'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:11:in `setup'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/setup.rb:17
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/user1/myproj1/config/boot.rb:6
from /home/user1/myproj1/config/application.rb:1:in `require'
from /home/user1/myproj1/config/application.rb:1
from /home/user1/myproj1/config/environment.rb:2:in `require'
from /home/user1/myproj1/config/environment.rb:2
from /usr/lib/ruby/1.8/rack/adapter/rails.rb:42:in `require'
from /usr/lib/ruby/1.8/rack/adapter/rails.rb:42:in `load_application'
from /usr/lib/ruby/1.8/rack/adapter/rails.rb:23:in `initialize'
from /usr/lib/ruby/1.8/rack/adapter/loader.rb:36:in `new'
from /usr/lib/ruby/1.8/rack/adapter/loader.rb:36:in `for'
from /usr/lib/ruby/1.8/thin/controllers/controller.rb:163:in `load_adapter'
from /usr/lib/ruby/1.8/thin/controllers/controller.rb:67:in `start'
from /usr/lib/ruby/1.8/thin/runner.rb:174:in `send'
from /usr/lib/ruby/1.8/thin/runner.rb:174:in `run_command'
from /usr/lib/ruby/1.8/thin/runner.rb:140:in `run!'
from /usr/bin/thin:6
So, naturally, I installed multi_json gem, then, bundle install, and, what do you think? Same old problem :).