Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?


In reply to Forcing return from Net::SSH::Perl connection by athomason

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found