Search code examples
ruby-on-railsrubythin

How to start thin for only one application?


In /etc/thin/ I've got several yml files. When I run service thin stop -C /etc/thin/app.yml thin stops all applications, instead of only the one I specified.

How do I get thin to stop/start only the specified application?

UPDATE: Hmm, in /etc/init.d/thin there's this: $DAEMON restart --all $CONFIG_PATH. That explains a lot. Are there smarter init.d scripts? This is my script:

https://gist.github.com/1003131

See also:

Running Rails apps with thin as a service


Solution

  • you have to edit /etc/init.d/thin adding a new action or modifying the "restart" action.

    as you can see, --all $CONFIG_PATH sends the command to all thin instances.

    paste the init script somewhere, we can find a decent solution ;)

    UPDATE:

    try to add the following lines, below this:

    restart)
      $DAEMON restart --all $CONFIG_PATH
      ;;
    restart-single)
      $DAEMON restart -C $2
      ;;
    stop-single)
      $DAEMON stop -C $2
      ;;
    

    I didn't tried it, but it should work well. this is a really simple solution (no error checking), we've added 2 new actions that must be called as:

    service thin restart-single /etc/thin/your_app.yml
    or
    service thin stop-single /etc/thin/your_app.yml
    

    let me know if it works ;)

    cheers, A.