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

I use thin as a server for my Sinatra application. It starts as follows:

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

Where environment.yml has thin material and config.ru is the general material that you will find in the rack file.

I would like to be able to daemonize (quite simply with a thin configuration file) and stop and restart it the same way as with apache / tomcat / etc.

When I try to do a thin stop or reboot or other things, I get:

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

Indeed, there is no such file. I tried to specify the pid file and location (e.g. /tmp/thin.pid to be easy) in a thin yml configuration in different places. All this does is change the location of the directory in the "no PID found in" message, but the pid file is not created.

Any ideas?

+6
source share
1 answer

A pid will be created when the thin one is demonized, so double check your configuration for daemonize: true . Given that this is yaml, spaces can lead to errors. Alternatively, select the --daemonize switch.

If the location of your pid file is not standard, you must also specify the configuration file when you issue stop:

 thin -C config/environment.yml stop 
+9
source

Source: https://habr.com/ru/post/899495/


All Articles