I'm using rsync-2.4.6 to sync web content between AIX boxes and Perl to
check the output of the log files (from the --verbose option) for
problems/errors encountered during synchronization.
Anyone aware of a list of possible errors that could be reported
back/encountered? i.e what regular expression/s should I be searching for
other than "/error/i" to indicate errors?
Or -- if anyone has done anything similar, I'd appreciate the feedback.
Thanks for the input,
Peter Bellamy
Here's the Perl script I'm using:
==>vi checklogs.pl
"checklogs.pl" 28 lines, 557 characters
+1 #!/usr/bin/perl
+2 # 07.02.2001
+3 # pkbellamy 2151
+4 # /opt/rsync/checklogs.pl
+5 # check rsync logs for errors
+6
+7 # Require explicit variable declarations
+8 use strict;
+9
+10 # Variables
+11 my ($date,$logfile,$logline,$worries);
+12 $worries=0;
+13
+14 $logfile="/opt/rsync/logs/rsync.log";
+15 open (LOGFILE,"<$logfile") || die "Argh!\n";
+16 while (<LOGFILE>) {
+17 chomp;
+18 if (/error/i) {
+19 print "ERROR: $_\n";
+20 $worries++;
+21 }
+22 }
+23
+24 print "No worries mate.\n" if ($worries==0);
+25
+26 close (LOGFILE);
The script's ouput when the log contains an I/O error:
==>./checklogs.pl
ERROR: IO error encountered - skipping file deletion
root@serverA:/opt/rsync
==>
The output when the log contains no errors:
==>./checklogs.pl
No worries mate.
root@serverA:/opt/rsync
==>