• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

[转] How to kill ruby on rails WEBrick server daemon

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

How to kill ruby on rails WEBrick server daemon

I have been running a rails app on a machine, which I can’t restart (no root access) or physically pull the plug on, just using the prepackaged rails server, WEBrick. But I quickly found out that it was not that easy to kill my app. I’d run something like script/server -d -p 25000 > /dev/null . 
Notice that -d puts the server in daemon mode and > /dev/nullsends all the standard out to /dev/null .
I tried to kill the app using top and then killing with the process ID, then tried pgrep and kill on the command line, to no avail.

Finally I found the (simple) solution that I’ll repost here. On the command line of the machine running the server:

pgrep ruby

This will give you the process id of the rails app (assuming you don’t have another ruby app running). Note: if pgrep is not available on your machine try using the command:

top

and look for the id of a process called ‘ruby’.

Now kill that process using the command:

kill -9 [id]

Where [id] is the process id given by pgrep.

Update:
It seems kill -9 may be jumping the gun and perhaps you ought to be safe and follow the advice I found elsewhere. 
I’ll reiterate his point here. After finding the process id using prgepissue the following commands waiting five seconds before trying the next one until the kill succeeds:

kill pid
kill pid
kill
-INT [id]
kill
-INT [id]
kill
-KILL [id]
kill
-KILL [id]

Notice that -KILL is the same as -9 .


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
linux下安装ruby环境发布时间:2022-07-14
下一篇:
ruby 除法运算发布时间:2022-07-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap