in reply to Net::SSH2 exec timeout
I tried using threads::shared but I couldn't seem to pass the reference to $ssh on to my thread.
Try it this way:
use threads; use Net::... my $ssh = ...; $ssh->scp_put($firmware[$antenna_type],'/tmp/fwupdate.bin'); async { print "Upgrading firmware, this will take about 3 minutes.\n"; my $chan = $ssh->channel(); $chan->exec("/sbin/fwupdate -m\n"); $chan->close; }->detach; ...
That should "work" and allow your main thread to continue. The thread Will hang around until the connection times out, but is that a problem?
Alternatively, could you detach the remote process into the background using &:
$ssh->scp_put($firmware[$antenna_type],'/tmp/fwupdate.bin'); print "Upgrading firmware, this will take about 3 minutes.\n"; my $chan = $ssh->channel(); $chan->exec( "/sbin/fwupdate -m &\n"); ### Note: & $chan->close;
Wouldn't that allow the connection to complete in a timely fashion?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::SSH2 exec timeout
by £okì (Scribe) on Sep 08, 2011 at 22:17 UTC | |
by BrowserUk (Patriarch) on Sep 08, 2011 at 22:32 UTC | |
by £okì (Scribe) on Sep 08, 2011 at 22:48 UTC | |
by BrowserUk (Patriarch) on Sep 08, 2011 at 23:12 UTC | |
by £okì (Scribe) on Sep 09, 2011 at 01:16 UTC | |
|