Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thin and sinatra - how to stop/restart? No thin.pid

Tags:

sinatra

thin

I'm using thin as the server for my Sinatra app. It is started thusly:

thin -C config/environment.yml -R config/config.ru start

Where environment.yml has thin stuff and config.ru has general stuff you'd find in a rackup file.

I would like to be able to daemonize (easy enough with thin's config file) and stop and restart this much like one does with apache/tomcat/etc.

When I try thin stop or restart or various other things, I get:

Can't stop process, no PID found in tmp/pids/thin.pid

Indeed, there is no such file. I have tried specifying a pid file and location (ex. /tmp/thin.pid, to be easy) in the thin configuration yml to various different places. All this does is change the location of the directory in the "no PID found in" message, still no pid file is created.

Any ideas?

like image 407
Hsiu Dai Avatar asked Oct 17 '11 21:10

Hsiu Dai


1 Answers

Pid will be created when thin is daemonized, so double-check your config for daemonize: true option. Considering that it's yaml, whitespace can make things go wrong. Alternatively specify --daemonize switch.

If location of your pid file is non-default, you should also specify config file when issuing stop:

thin -C config/environment.yml stop
like image 105
Slartibartfast Avatar answered Sep 28 '22 08:09

Slartibartfast