开发者

Ruby background service

I have a TCPclient written on Ruby. I want to use it in background. Currently it has a loop:

loop d开发者_Go百科o
end

So i can run a client, and it works forever.

Is there a way to run in as a service, and write a pid to file, then i'll able to kill that process by pid?


The daemons gem is made just for this.


You can use the unix system for that :

ruby myfile.rb && echo $! > my_file.pid
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜