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 &
?
3 Answers
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.

- 3,876
- 2
- 32
- 24
If stalker itself does not provide that option, you could try daemonize
or something similar:

- 66,324
- 14
- 138
- 158
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.

- 933
- 2
- 13
- 25