If you are stuck with the running Mongrel or Webrick daemon mode like myself for Redmine or for any other reason and need to shut it down or restart, here’s you can kill the process. After setting up Redmine by starting ruby script/server webrick with -d option, there was no way to shut it down.
Mongrel leaves his pid in tmp/pids so you can go there and check the process id (PID). For webrick you don’t have that choice. One choice that you do have is listing procesess and filtering for ruby.
ps aux | grep ruby
There you can see process id (PID) that you need to kill:
kill -9 PID
You don’t need to type -9 for mongrel, but you do that for webrick.
Sometimes Mongrel will refuse to restart, and you will see similar error:
** !!! PID file log/mongrel.pid already exists. Mongrel could be running already. Check your log/mongrel.log for errors. ** !!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start.
To fix it, find the pid file in the log folder of you app. For instance, your app is running here /home/rails_app/. you should search pid file in /home/rails_app/log/mongrel.pid. Find it and delete it and restart the Mongrel like this:
mongrel_rails start --environment=production -d
Hope that helps.