HI,
My client scrip connect to remote ssh server, and execute perl scrip.
Remote STDOUT and remote STDERR redirect to local file.
**** sbackup.pl
if ( $sshconn = Net::SSH::Perl->new("localhost", %params) )
{
$sshconn->login('op');
$sshconn->register_handler("stdout", sub {
my($outchannel, $outbuffer) = @_;
print(FOUT $sshconn->type);});
$sshconn->register_handler("stderr", sub {
my($errchannel, $errbuffer) = @_;
print(FERR $errbuffer->bytes);});
($ssherr, $ssherr, $sshexit) = $sshconn->cmd("/tmp/bufile.pl");
$sshconn->cmd("exit");
}
****bufile.pl
print(STDERR "TAR START...\n");
system("tar -cmvzf /tmp/large.tgz /tmp/largedir");
print(STDERR "TAR END.\n");
after (1 hour) server sent this message:
Apr 27 16:22:38 mylinux sshd32703: debug1: need rekeying
Apr 27 16:22:38 mylinux sshd32703: debug1: SSH2_MSG_KEXINIT sent
and client log:
mylinux: channel 1: window 14729 sent adjust 18039
mylinux: channel 1: window 1655 sent adjust 31113
mylinux: Warning: ignore packet type 20
...and data transfer stop
janitored by ybiC: Balanced <code> tags around codeblock, and balanced <tt> tags around error and log text
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.