I am having issues with daemons (to a process in detached from terminal) as in:
/usr/local/jruby-1.1.4/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:122:in `each_object': ObjectSpace is disabled; each_object will only work with Class, pass +O to enable (RuntimeError)
I am just trying to use daemons to run a process detached from the tty (so that it will continue to run after I logout). I think I am using daemons in the most simplistic case:
> cat daemonize.rb
#!/usr/bin/env jruby
require 'rubygems'
require 'daemons'
Daemons.run('scaleMatrix.rb')
# end
>
scaleMatrix itself is a jruby script. Using this under ruby e.g. using ruby calling a ruby script, appears to work correctly (simple tests), however this is not the case with jruby.
Is there perhaps a better way of detaching from the controlling tty and have the process run after I log out?
TIA!
Phy
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
So now I am stuck. Either I need to enable an 'unsafe' method or I need some help in understanding how to create a daemonized process e.g. a process that is detached from the parent tty so that I can log out and still have the application/process run. Any suggestions?
Thanks for the help!
Phy
--- On Mon, 10/20/08, Phy Prabab <phyp...@yahoo.com> wrote:
Okay, so further testing shows that indeed, fork system call fails (or at least I believe it fails) on my sparc machine:
> jruby -X+O -J-Djruby.fork.enabled=true scaleMatrix.rb start
WARNING: fork is highly unlikely to be safe or stable on the JVM. Have fun!
/usr/local/jruby-1.1.4/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:151:in `call_as_daemon'/usr/local/jruby-1.1.4/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:151:in `call_as_daemon': No child processes - No child processes: No child processes - No child processes (Errno::ECHILD)
(Errno::ECHILD)
...
So now I am truly stuck. Can anyone please educate me on how to create a daemon process with Jruby? I just need to be able to launch this application/process and be able to log out and have the application/process continue to run (for several weeks). Any help is greatly appreciated!
Cheers,
You will likely have more luck with this posting to the JRuby-User list.
Michael Guterl
Opps, I thought I had posted to that group. Sorry for the junk email and thanks for the correction!
Cheers,
Phy
--- On Mon, 10/20/08, Michael Guterl <mgu...@gmail.com> wrote:
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
Sorry for the interruption, my mistake.
Cheers!
Phy
--- On Mon, 10/20/08, Michael Guterl <mgu...@gmail.com> wrote:
> From: Michael Guterl <mgu...@gmail.com>
> Subject: Re: [jruby-user] daemons
> To: us...@jruby.codehaus.org
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
That's a good idea and in fact, I have tried unsuccessfully to have an external jruby wrapper invoke the scaleMatrix jruby script, but I run into the same problem.
Perhaps you are suggesting that I use a different language to accomplish this? I am on the thought of writing a simple c app to setsid on the process, but was hoping this could all be done in ruby/jruby (well ruby actually does work).
Any thoughts?
--- On Mon, 10/20/08, Jacob Kessler <Jacob....@Sun.COM> wrote:
Maybe I have missed something, but couldn't you just put the entire process in the background instead of forking it?
Something like:
jruby scaleMatrix.rb &
or doing it with nohup?
Cheers,
Chiaming Hsu
You know what, you are absolutely right! I had thought that nohup-ing would not detach it from the controlling process, but I just tested and sure enough, I can log out and still the process runs. Too simple. So thanks for pointing out the obvious!
Cheers,
Phy
--- On Mon, 10/20/08, Chiaming Hsu <cam...@yahoo.com> wrote: