Topic: Restarting fcgi from controller

So I finally got my site up at hostingrails, and I wanted to hone the update process.  When logged in as an administrator, I have a page where I can do a 1-click update.  My controller code spawns a ruby process that runs an update script.  The update scripts does an svn update, and if there are new files, it's supposed to restart the server.
The problem is that I haven't been able to successfully kill the dispatch.fcgi processes.  I was wondering if anybody else has tried to do the same thing as I.  In about two months, I will just run a cron job (which shouldn't have these issues), but for now I'd like to do it from the browser.
All I've been able to get is making one of the fcgi processes a zombie.  And since it's parent doesn't restart, the 'old' version of my files may still be loaded.  I've tried spawning the ruby script with nohup, I've tried forking and Process.detach, and I've tried exec'ing killall, and nothing has worked the way I thought it would.
Any suggestions? 


Last edited by bkrahmer (2007-01-26 01:26:56) - Brewery and Brewpub management powered by RoR

Re: Restarting fcgi from controller

High five!</borat>
I seemed to have solved it by grabbing the pid in the controller, passing it to my ruby script, and using Process.kill instead of killall.  What is really sweet (not that it matters to my users) is that the browser doesn't skip a beat.  (The pids have changed, but I didn't get any 500 pages.) - Brewery and Brewpub management powered by RoR