How to restart Rails from within Rails?

后端 未结 3 1605
轻奢々
轻奢々 2021-02-09 13:53

Ok, so I would like to create an action in Rails to restart itself. I did a little searching and found:

http://snippets.dzone.com/posts/show/5002

Which suggests

3条回答
  •  误落风尘
    2021-02-09 14:29

    If you don't mind switching to mod_rails, you can restart your server by creating $RAILS_ROOT/tmp/restart.txt, which causes only the Rails instance you care about to restart.

    Your PS command looks (cursorary glance) like it will kill all rails processes on your box. That's fine if you are the only Rails app on a machine, but if there's a few running as the same user or you are running as root you'll kill them all. Bad form!

    This points it out for mongrel. There's the way you want to try.

提交回复
热议问题