开发者

Running stalker (Ruby gem) as a daemon

Is it possible to run the Ruby gem stalker as a daemon?开发者_如何学运维 Something like as stalk jobs.rb -d. Should I just use stalk jobs.rb &?


You could use your OS's startup system to run and respawn the process for you.

If you're on Ubuntu, a simple Upstart script has the advantage that you can simply write the script to stay in the foreground ( do no daemonizing, forking, storing of PIDs etc). When Upstart runs the script for you, it will take care of running it as a daemon for you.

This way, you get to write a simple script that runs in the foreground for development, have the script startup at boot time in production, it can have dependencies on other startup scripts and best of all - you get init to respawn jobs that die.

You can get Upstart to run the job as any user you like - so you can kill the job as that user if required and the OS will happily respawn it for you.

No more watching the watcher who watches your job.


If stalker itself does not provide that option, you could try daemonize or something similar:

http://software.clapper.org/daemonize/


Have you had a look at http://railscasts.com/episodes/130-monitoring-with-god

Need to ensure your background processes stay up and running and don't use too many resources? Check out the god gem as shown in this episode.

I use it for handling my video transcode workers. It seems very reliable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜