Thin 'init.d' With Individual Server Support
Aug 24, 2012

I’m using thin for several apps on my server, and the default init.d script only knows how to restart all of them at once, which obviously can sometimes be too drastic, so I hacked up a gentler version:

I’m using thin for several apps on my server, and the default init.d script only knows how to restart all of them at once, which obviously can sometimes be too drastic, so I hacked up a gentler version:

1
service thin start|stop|restart [server]
  

Omitting the server keeps the old behaviour.

It will use bundle exec if it finds a Gemfile in the webapp’s root directory.

The script sets and exports HOME because Debian’s service strips it away but bundler needs it to find gems installed from git in lieu of vendor, if you happen to not be using it.

gist