After writing rails_cron, and working with backgroundrb, I realized that I want something simpler. Much simpler. So I wrote the daemon_generator plugin. I think the whole thing is about 50 lines of code.
"./script/generate daemon <name>" gives you a simple stub that you can dump code in that will run in the rails environment as a background process. You're responsible for making it do something useful (try accessing stored tasks in a memcache or DB-based queue). If you want messaging, try backgroundrb.
Features:
- Capistrano-friendly i.e.:
task :after_restart do
run "#{current_path}/script/daemons restart"
end
- Per-daemon start scripts
- Per-app start scripts
- Graceful stop and restart
- Per-daemon logging in your log folder
- Automatic restart of a crashed daemon
- Not thread-based
Go get the plugin:
daemon_generator 0.5.0 | README
Social Links