Hi Folks,
I've been searching around for solutions to my questions and have ended up at Perl Monks several times. So I figure this is the place to ask!
Essentially running this code returns inconsistent results. Sometimes I'll get 113 items, sometimes 102, sometimes 0. The returned output should be an md5 sum of each file on the server.
#!/usr/bin/perl
use Net::SSH2;
$ssh2 = Net::SSH2->new();
$ssh2->connect('asdfasdfas.com') or die $!;
$ssh2->auth_password('user','pass') or die "Unable to login $@ \n";
$ssh2->debug(0);
$chan2 = $ssh2->channel();
$chan2->blocking(0);
$chan2->shell();
print $chan2 "bash ~/md5xml\n";
print "LINE : $_" while <$chan2>;
$chan2->close;
print 'done...';
Also the script md5xml runs
find ./public_html -type f -exec md5sum {} \;
I would have type this into exec directly, but I couldn't figure why my \ wasn't escaping properly.
Also somebody suggested running this code
$l=<$chan2>, print "LINE : $l" while !eof($chan2);
but unfortunately this server never seems to return an eof!
Any help appreciated! This has really been kicking my but!
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.