Thank you, Rob for the quick reply and help. I tried the commmand you
enclosed in the mail. It did not work out. I still got hang at the
exec() command.
Here are the options I did. They behave the same. They don't work. By
the way, my linux system has setsid().
ssh.exec!("setsid /root/test.pl >/tmp/test.log 2>&1")
ssh.exec!("setsid /root/test.pl > /dev/null 2>&1")
ssh.exec!("setsid /root/test.pl")
Thanks.
Enling
Rob Biedenharn wrote:
> On Jul 9, 2009, at 5:13 PM, Enling Li wrote:
>
>> The above code hangs also because test.pl contains a long sleep and do
>>>
>>> I can do this from a shell by suffixing an '&':
>>>
>>> java -cp <classpath> <main_class>&
>>>
>>> starts the Java program in a background process thread and returns
>>> control the shell.
>>>
>>> When I try this from a Ruby program the program blocks until the Java
>>> program is terminated.
>
> If your system has the `setsid` (set session id) program (and the
> underlying system call), then you could try:
>
> ssh.exec!("setsid /root/test.pl")
>
> or
>
> setsid java -cp YOURCLASSPATH MainClass
>
> but you may wish to redirect output.
>
> ssh.exec!("setsid /root/test.pl >/tmp/test.log 2>&1")
>
> -Rob
>
> Rob Biedenharn http://agileconsultingllc.com
> Rob / AgileConsultingLLC.com
--
Posted via http://www.ruby-forum.com/.