开发者

Process.daemon vs. running a Ruby script with nohup + &

开发者 https://www.devze.com 2022-12-19 05:59 出处:网络
I have a Ruby 1.9 script that I want to run as a long-running background process. It looks like I have a choice between calling Process.daemon inside the script to daemonize it, or I c开发者_如何学J

I have a Ruby 1.9 script that I want to run as a long-running background process.

It looks like I have a choice between calling Process.daemon inside the script to daemonize it, or I c开发者_如何学JAVAan just run the script in the background using a shell's ampersand and keep it running after I log out of the server by prefixing the command with nohup.

Which way is better?


Process.daemon seems like a more clean and straightforward way, especially if this is something you would ever way to turn into a full-fledged daemon that is started during boot.

0

精彩评论

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