newer rsnapshot versions log the date in a different format
authorMatthias Förste <foerste@schlittermann.de>
Tue, 13 Feb 2018 13:02:59 +0100
changeset 31 072b9adfb2ac
parent 30 2c350ec405a1
child 32 3072e35252cb
newer rsnapshot versions log the date in a different format
check_rsnapshot.pl
--- a/check_rsnapshot.pl	Thu Dec 12 16:45:10 2013 +0100
+++ b/check_rsnapshot.pl	Tue Feb 13 13:02:59 2018 +0100
@@ -1,7 +1,7 @@
 #! /usr/bin/perl -w
 
 #    Copyright (C) 2011-2013  Christian Arnold
-#    Copyright (C) 2013       Matthias Förste
+#    Copyright (C) 2013-2018  Matthias Förste
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@
 sub version($$);
 
 my $ME      = basename $0;
-my $VERSION = "2.9";
+my $VERSION = "2.10";
 
 my %opt = (
     binary => "/usr/bin/rsnapshot",
@@ -63,7 +63,8 @@
 
     my @logfiles = @ARGV ? @ARGV : glob '/var/log/rsnapshot.log{,.1.gz}';
 
-    my $date = UnixDate(ParseDate($opt{date}), "%d/%b/%Y");
+    # older versions log the date as %d/%b/%Y
+    my $date = UnixDate(ParseDate($opt{date}), "%d/%b/%Y|%Y-%m-%d");
     unless ($date) {
         print "RSNAPSHOT CRITICAL: can't parse date [$opt{date}]\n";
         exit $ERRORS{CRITICAL};
@@ -159,7 +160,7 @@
 Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix
 support.
 
-Copyright (C) 2013 by Matthias Förste and Schlittermann internet & unix support.
+Copyright (C) 2013-2018 by Matthias Förste and Schlittermann internet & unix support.
 
 $ME comes with ABSOLUTELY NO WARRANTY. This is free software,
 and you are welcome to redistribute it under certain conditions.
@@ -234,13 +235,13 @@
 
 2011-2013 Originally written by Christian Arnold L<arnold@schlittermann.de>.
 
-2013      Maintained by Matthias Förste L<foerste@schlittermann.de>.
+2013-2018 Maintained by Matthias Förste L<foerste@schlittermann.de>.
 
 =head1 COPYRIGHT
 
 Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix
-support. Copyright (C) 2013 by Matthias Förste and Schlittermann internet &
-unix support. This is free software, and you are welcome to redistribute it
+support. Copyright (C) 2013-2018 by Matthias Förste and Schlittermann internet
+& unix support. This is free software, and you are welcome to redistribute it
 under certain conditions. See the GNU General Public Licence for details.
 
 =cut