Using "thin -R config.ru -d start/stop" the return code depends
on the success/failure of the operation. However when using "-C
cluster.conf" thin command returns 0 (success) even if the servers
failed to start/stop.
For example: I've started thin cluster (3 servers) with root
user and now try to stop them with normal user ("ibc"):
First I try to stop an individual server:
~$ thin -P pid.9292 stop
Sending QUIT signal to process 16016 ...
/usr/local/lib/ruby1.9/gems/1.9.1/gems/thin-1.2.5/lib/thin/daemonizing.rb:113:in `kill': Operation not permitted (Errno::EPERM)
~$ echo $?
1
Due to permissions issues I get an error and 1 as return code
(OK).
Now I try using "thin -C":
~$ thin -C cluster.conf stop
Stopping server on 0.0.0.0:9292 ...
Sending QUIT signal to process 16016 ...
/usr/local/lib/ruby1.9/gems/1.9.1/gems/thin-1.2.5/lib/thin/daemonizing.rb:113:in `kill': Operation not permitted (Errno::EPERM)
~$ echo $?
0
Unfortunatelly it returns 0 (success). This is a very big issue
when using service init scripts or some daemons (as HeartBeat)
which totally rely on service response status.
So I suggest "thin -C" to collect all the response status from
individual "thin -R" calls and return 0 just in case all the
operations returned 0.