Monks-
I'm using Net::SSH::Perl (thanks btrott!) in non-interactive mode to start up a daemon on another server. The daemon needs to stay alive after my connection dies, so I've been attempting to start up the process in the background. However, $ssh->cmd( "~/startup.pl &" ) hangs after executing the command. I thought I could trick the system with $ssh->cmd( "sh -c '~/startup.pl &'" ) but that hangs just the same. If the daemon (or any process, e.g. perl -e 'sleep 10') eventually exits on its own, the $ssh->cmd call returns and the programs returns. It seems that the login shell won't return until the process it spawned dies. This seems to generalize to other login shells as well (I tried rsh), but not non-login shells. My last resort would be an alarm to kill the connection, but that's painfully ugly. Does anyone know how to disable or work around this behavior within Net::SSH::Perl?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|