在Ruby中创建后台进程并注册PID
问题描述:
使用ruby在后台启动多进程的最佳方式是什么?我需要使用Thread.new
?在Ruby中创建后台进程并注册PID
我有一个像5个进程在后台启动的话,我想要得到的PID正确停止所有process.In bash的我能做到这一点easyli:
htop &
echo $! >/tmp/htop.pid
而且杀:
kill `cat /tmp/htop.pid`
我希望能够做同样的事情用Ruby