Simpler scgi_ctrl


#1

I’ve been using Zed S.'s SCGI Rails Runner for a while and I like
how simple it makes stopping and starting the rails instances.
However, I don’t like that it relies on Drb (as that requires a
password and additional process). If you turn off Drb, then you can’t
easily stop or restart the rails processes, as you have to grep the
process list and send the necessary signals yourself.

I’ve attached a small script that handles starting and stopping the
rails processes without requiring Drb, by using a pid file to store
the process id. It accepts only two commands, start and stop. If you
want to use it, copy it to the same folder as scgi_ctrl, add
“:disable_drb: true” to scgi.yaml then switch to the directory of the
rails add and run:

sscgi_ctrl start # To start/restart
sscgi_ctrl stop # To stop

It accepts a directory for the rails app:

sscgi_ctrl start /path/to/rails_app

It also accepts a config file name and pid file name:

sscgi_ctrl start /path/to/rails_app config/scgi.yaml.development
log/scgi_rails.pid.development

No testing (other than “works for me”) or documentation included. It
doesn’t support clustering or sending signals other than TERM, but
those shouldn’t be difficult to add. It doesn’t support Windows. It
was designed with purely my own needs in mind, but just in case
someone else here might want similar functionality, I decided to mail
it to the list.