Saturday, July 7, 2012

ruby on rails daemon

akob:ceramahonline akob$ rails plugin install git://
Initialized empty Git repository in /Users/akob/hak/ceramahonline/vendor/plugins/daemon_generator/.git/
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 25 (delta 2), reused 20 (delta 1)
Unpacking objects: 100% (25/25), done.
From git://
 * branch            HEAD       -> FETCH_HEAD
Daemon Generator

To get yourself rolling:
> sudo gem install daemons
> ./script/generate daemon

Then insert your code in the lib/daemons/.rb stub. All pid's and logs will live in the normal log/ folder.  This helps to make things Capistrano friendly.

Individual control script:
> ./lib/daemons/_ctl [start|stop|restart]

App-wide control script (I add this to my capistrano recipe's after_restart task):
> ./script/daemons [start|stop|restart]
akob:ceramahonline akob$

No comments:

Post a Comment