diff --git a/CHANGELIST b/CHANGELIST index c35106b..dafbbec 100644 --- a/CHANGELIST +++ b/CHANGELIST @@ -1,4 +1,6 @@ -1.0.9 added CR/LF after --check-health message output to make CLI usage cleaner looking +1.0.10 added --monitor-version to check installed version against current version in trunk on GitHub + +1.0.9 added CR/LF after --monitor-health message output to make CLI usage cleaner looking 1.0.8 added --version checking in sanoid and syncoid diff --git a/VERSION b/VERSION index 66c4c22..7ee7020 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.9 +1.0.10 diff --git a/sanoid b/sanoid index 5e2c9e4..8af26d3 100755 --- a/sanoid +++ b/sanoid @@ -4,13 +4,14 @@ # from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this # project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE. -my $version = '1.0.9'; +my $version = '1.0.10'; use strict; use Config::IniFiles; # read samba-style conf file use File::Path; # for rmtree command in use_prune use Data::Dumper; # debugging - print contents of hash use Time::Local; # to parse dates in reverse +use LWP::Simple; # to check VERSION against trunk on Github my $pscmd = '/bin/ps'; @@ -43,6 +44,9 @@ if ($ARGV[0] eq '--verbose') { } elsif ($ARGV[0] eq '--version') { print "Sanoid version: $version\n"; exit 0; +} elsif ($ARGV[0] eq '--monitor-version') { + monitor_version(); + exit 0; } elsif ($ARGV[0] eq '--cron' || 1) { take_snapshots (@params); prune_snapshots (@params); @@ -55,6 +59,18 @@ exit 0; #################################################################################### #################################################################################### +sub monitor_version() { + my $trunkversion = get("https://raw.githubusercontent.com/jimsalterjrs/sanoid/master/VERSION"); + chomp $trunkversion; + if ($version eq $trunkversion) { + print "OK: local version $version matches trunk version $trunkversion\n"; + exit 0; + } else { + print "WARN: local version $version does not match trunk version $trunkversion\n"; + exit 1; + } +} + sub monitor_health() { my ($config, $snaps, $snapsbytype, $snapsbypath) = @_; my %pools;