jlhsgcib has asked for the wisdom of the Perl Monks concerning the following question:
The following code runs 5 ssh in parallel.
I need a terminal because sudo(8) wants one (using -S doesn't help). Note that I use a key pair to connect, so no password is asked.
However, the output is the following:#!/usr/bin/perl use strict; use warnings; my $i; for ($i = 0; $i < 5; $i++) { my $pid = fork; if ($pid) { next } exec 'ssh -t 127.0.0.1 "sudo echo hello"'; exit 0; } for (; $i > 0; $i--) { wait }
hello
Connection to 127.0.0.1 closed.
hello
Connection to 127.0.0.1 closed.
hello
Connection to 127.0.0.1 closed.
hello
Connection to 127.0.0.1 closed.
hello
Connection to 127.0.0.1 closed.
And afterward, echo is disabled on the TTY and I need to use "reset".
Do you have any idea about I could solve this, please?
Thank you very much.
Best regards,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TTY screwed when running multiple ssh
by Illuminatus (Curate) on Sep 12, 2008 at 17:30 UTC | |
by jlhsgcib (Novice) on Sep 16, 2008 at 08:42 UTC | |
|
Re: TTY screwed when running multiple ssh
by swampyankee (Parson) on Sep 12, 2008 at 16:40 UTC |