Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:13:50+00:00 2026-06-01T11:13:50+00:00

I wrote a bash script to start thin server for two projects. #! /bin/sh

  • 0

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 :).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:13:52+00:00Added an answer on June 1, 2026 at 11:13 am

    I found the answer here.

    Added to the beginning these lines to my bash script:

    # Load RVM into a shell session *as a function*
    if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
    
      # First try to load from a user install
      source "$HOME/.rvm/scripts/rvm"
    
    elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
    
      # Then try to load from a root install
      source "/usr/local/rvm/scripts/rvm"
    
    else
    
      printf "ERROR: An RVM installation was not found.\n"
    
    fi
    
    rvm use 1.9.2
    

    In order to check that everything is correct, inside the bash and immediately below the mentioned code I used

    type rvm | head -1
    

    If the above outputs: rvm is a function, then everything’s fine.

    NOTE: The same thing should go to the cron files if for some reason they don’t seem to work with RVM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

following is the bash script I wrote for Sqlite. #!/bin/bash sqlite3 file.db CREATE TABLE
This is a very simple bash script I wrote: #!/bin/bash ITEM_LIST=items.txt LOG_FILE=log.log TOTAL_ITEMS=$(wc -l
I wrote the following shell script: #!/bin/bash MAIL=/usr/mail/${LOGNAME:?} . /installations/etl_scripts/etl_job.properties JOB_LOG_FILE_PATH=$JOB_LOG_FILE_PATH export JOB_LOG_FILE_PATH JOB_LOG_FILE_NAME=$JOB_LOG_FILE_NAME
I wrote a bash script under CentOS and it was executed well. On another
I wrote a short bash script to complete a task that involves creating a
I wrote a tiny Bash script to find all the Mercurial changesets (starting from
I wrote a function in bash script. However, it's complaining about syntax. I really
I'm trying to run multiple instances of a node server using a bash script.
I wrote a simple bash script because I was using a grep command with
I wrote a script for a Linux bash shell. One line takes a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.