|more useful options|
cygwin opensshd: how to detach remotely with fork/exec?by Boldra (Deacon)
|on Dec 13, 2012 at 10:28 UTC||Need Help??|
Boldra has asked for the
wisdom of the Perl Monks concerning the following question:
This question has a lot of non-Perl parts to it, but I'm running a Perl script on a remote machine, so it would be nice to solve the problem in Perl.
I'm trying to start a detached process on a remote server. The following test shows my problem:
If the remote machine is linux, the first version waits for 20 seconds, and the second version exits immediately. But most of my machines are windows machines running cygwin opensshd, and the connection stays open until the child is finished in both versions. I can't do the detach on my side of the connection because I need to conserve network ports.
One option has been to use sysinternals psexec -d to launch the detached process, but this frequently fails silently, particularly shortly after booting the machine. It does at least close the ssh connection immediately. Since I'm running a Perl script on the remote machine anyway, it would make sense to do this completely in Perl. My ssh calls are actually made via Net::OpenSSH, but the test shows that this is not causing the problem.
(I tried posting this on G+ yesterday to see if the perl "community" there could help: https://plus.google.com/#communities/105035827361077606043. So far nothing )