The first part checks for the filesystem type.. zfs - do nothing, since it doesn't use SVM... the 2nd part of the if statement processes the ufs part, by running metastat -p and counting the number occurrences of the letter d... for a mirror with 2 plexes it should be 3, one for the metadevice, and one for each plex. Anything less than 3 gets thrown out as being unsynched. The $mirror_cmd is the metastat -p |grep m to get the metadevices only.

Here is the while loop for that part of the code:
while ( defined ($line = $ssh->read_line()) ) { if($line =~ m/zfs/) { open(MIR,">>$MIRRORS"); print MIR "$_ - has ZFS root, no metadevices e +xist\n"; close(MIR); } else { # Not ZFS, presumably ufs # Execute SVM Mirror check - looking for unsyn +ched mirrors my $mirror_output = $ssh->send("$mirror_cmd"); my $line2; while ( defined ($line2 = $ssh->read_line()) ) + { my $tmpcount = ($line2 =~ tr/d//); if($tmpcount < 3) { open(MIR,">>$MIRRORS"); print MIR "$_: "; chomp(); print MIR "$line2 - Not Mirror +ed\n"; close(MIR); } } } }

On a side note, apparently setting PS = ; had no effect, because it's still showing the same output as earlier.

Thanks!

In reply to Re^2: Net::SSH::Expect output by sierpinski
in thread Net::SSH::Expect output by sierpinski

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.