Question

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 &?

Was it helpful?

Solution

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

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

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top