How to start thin for just one application?

In / etc / thin / I have some yml files. When I run service thin stop -C /etc/thin/app.yml , thin stops all applications, not just the ones I specified.

How can I become thin in order to stop / start only the specified application?

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

https://gist.github.com/1003131

See also:

Running Rails Thin Service Applications

+4
source share
3 answers

you need to edit the /etc/init.d/ file by adding a new action or changing the "restart" action.

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

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

UPDATE:

try adding the following lines below :

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

I have not tried it, but it should work well. this is a really simple solution (without error checking), we added 2 new actions that should 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;)

amuses A.

+5
source

I propose another solution (which, I think, is more subtle-convenient):

  • set the contents of your /etc/init.d/thin file to use my fixes:

     #!/bin/sh ### BEGIN INIT INFO # Provides: thin # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: thin initscript # Description: thin ### END INIT INFO # Original author: Forrest Robertson # Do NOT "set -e" DAEMON=/usr/local/bin/thin SCRIPT_NAME=/etc/init.d/thin CONFIG_PATH=/etc/thin # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 if [ "X$2" = X ] || [ "X$3" = X ]; then INSTANCES="--all $CONFIG_PATH" else INSTANCES="-C $3" fi case "$1" in start) $DAEMON start $INSTANCES ;; stop) $DAEMON stop $INSTANCES ;; restart) $DAEMON restart $INSTANCES ;; *) echo "Usage: $SCRIPT_NAME {start|stop|restart} (-C config_file.yml)" >&2 exit 3 ;; esac : 
  • Use thin restart -C /etc/thin/my_website.yml . This syntax can be used with the start , restart and stop commands. However, thin restart (either start or stop , of course) will infect all registered instances.

0
source

This is strange, I added a patch for the script from the very stone for the init script for the next build, to allow one restart on future installations.

restart file) $ DAEMON restart -C $ 2 ;;

but the owner of the gem refused to merge and said that you can use a thin start - C / path /, which is strange because I tried a lot and the script itself is all and not a single configuration is allowed, I also tried to do what he said, and obviously he restarted everything, since the script uses everything, can someone shed more light on this https://github.com/macournoyer/thin/pull/176

0
source

All Articles