« Return to Thread: [Q] how can I start a shell process and return immediately?

Re: how can I start a shell process and return immediately?

by Enling Li :: Rate this Message:

Reply to Author | View in Thread

I have another quetion related to fire off a back ground shell process
on a remote Linux.

    require "net/ssh"

    ssh = Net::SSH.start( '10.0.77.87', 'toor',  :password=>'logapp')
    ssh.exec!("/root/test.pl &")
    ssh.close
    puts "I want to be here immediately, but not"

The above code hangs also because test.pl contains a long sleep and do
nothing. Can someone offer me a help?

Thank you in advance.

Enling

Stephen Bannasch wrote:

> I want to start a Java program from a Ruby program and have the Java
> program run in another process and have control returned to my Ruby
> program as soon as the Java process starts up successfully.
>
> 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.

--
Posted via http://www.ruby-forum.com/.

 « Return to Thread: [Q] how can I start a shell process and return immediately?