Hi folks. Im seeking your wisdom, please, enlight me. This its a piece of the code im using, its a perl script to run backups from linux servers from everything. The problem its, i want to know if something fails using rsync. I took a look to the Rsync module on CPAN and it would give me the option to catch up the stderr, so it could be nice, but its mandatory that i use a ssh certificate instead a password / login to access the remote rsync server. And perl wrapper rsync module doesnt give this thing. Anyone knows how i can catch back the results of the rsync ? There's another possibility than parse the $_ while i am reading it?
# MYSQL BACKUP my @bk_mysql = qx(/usr/bin/mysql -u $uMy -p$pMy -e 'show databases'); foreach $1 (@bk_mysql){ chomp $1; $fMy = "mysql_-$1-$tLog"; $mysqlC ++; print "$mysqlC MySQL Database $1\n"; qx (mysqldump -u $uMy -p$pMy $1 | gzip -9 > $foMy/$fMy.gz ); print "Compressing file $fMy\n"; qx (/usr/bin/rsync -avzP -e "ssh -i /root/.ssh/rsyncstrato" $ +foMy/$fMy.gz account-xxxx\@rsync.hidrive.strato.com:/users/account-xx +xx/backups/mysql/$tLog/ ); print "Sending Backup to Cloud..\n"; qx (rm $foMy/$fMy.gz); print "Backup file uploaded and deleted $foMy/$fMy\n"; printf LOG "DB DONE -> $foMy/$fMy\n"; push @mysql_re, $fMy; push @mysql_status, @$; }

In reply to Another way to catch rsync STDERR by PsySkeletor

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.