Rob Lacey
2008-Nov-12 17:24 UTC
What''s the cleanest way to add have a start / stop control with EventMachine
Hi there, I''m new to playing with EventMachine and I wondered if anyone has a nice way of backgrounding it and start / stopping it from the command line like an init script. e.g. ./mydaemon start|stop I''ve not seen an example of this and search through the Juggernaut gem source I couldn''t get the come I''d stolen from it to work with a basic echo server. e.g. mydaemon start|stop Any ideas? RobL --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
joserwan
2008-Nov-13 14:07 UTC
Re: What''s the cleanest way to add have a start / stop control with EventMachine
Here''s what I did :
# ============================# script/em_manager
# I did a chmod +x on this file
#!/usr/bin/env ruby
require ''rubygems''
require ''daemons''
options = {
:app_name => "em_manager",
#:ARGV => [''start'', ''-f'',
''--'', ''param_for_myscript'']
#:dir_mode => :normal,
#:dir => path,
:multiple => false,
#:ontop => true,
:mode => :load,
:log_output => true,
#:keep_pid_files => true,
#:backtrace => true,
# :monitor => true
}
#====================# app/daemons/em_client.rb
EventMachine::run {
(...)
}
Daemons.run(''./app/daemons/em_client.rb'', options)
On Nov 12, 12:24 pm, Rob Lacey
<r...-JfOZzmRpUsu/uRbK1X5IkLHvCTsVnGdA@public.gmane.org>
wrote:> Hi there,
>
> I''m new to playing with EventMachine and I wondered if anyone has
a nice
> way of backgrounding it and start / stopping it from the command line
> like an init script.
>
> e.g. ./mydaemon start|stop
>
> I''ve not seen an example of this and search through the Juggernaut
gem
> source I couldn''t get the come I''d stolen from it to work
with a basic
> echo server.
>
> e.g. mydaemon start|stop
>
> Any ideas?
>
> RobL
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---