exactly. I would be running the server script which has the
ssh key shared to the other machine(no passwd is prompted)
I've implemented your suggestion in, but the client is not
getting anything back. It is waiting on the
@results = <SOCKET> indefinitely
here's the modified client:
if (socket(SOCKET, PF_UNIX, SOCK_STREAM, 0)) {
connect(SOCKET, sockaddr_un($file)) || die "Could not connect:
+ $!";
print SOCKET $cmd;
@results = <SOCKET>;
print @results;
here's the modified server:
socket(SERVER, PF_UNIX, SOCK_STREAM, 0) || die "Could not create socke
+t: $!";
unlink("$file");
bind(SERVER, $addr) || die "Could not bind: $!";
listen(SERVER,SOMAXCONN) || die "Could not listen: $!";
while (accept(CLIENT,SERVER) || die "could not accept: $!") {
$cmd = <CLIENT>;
if ($cmd) {
$cmdd = "ssh2 rob\@machine_b $cmd";
+
open(CMD, "$cmdd |");
@results = <CMD>;
close(CMD);
+
print CLIENT @results;
}
}
somehow the
print CLIENT @results is not
actually returning the results....guess i have to do more tests
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.