added version checking command to sanoid and syncoid

This commit is contained in:
Jim Salter 2014-11-18 10:18:43 -05:00
parent b257eac788
commit 33d154d04b
2 changed files with 13 additions and 1 deletions

5
sanoid
View File

@ -4,6 +4,8 @@
# 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.8';
use strict;
use Config::IniFiles; # read samba-style conf file
use File::Path; # for rmtree command in use_prune
@ -38,6 +40,9 @@ if ($ARGV[0] eq '--verbose') {
monitor_health(@params);
} elsif ($ARGV[0] eq '--force-update') {
my %snaps = getsnaps( \%config, $cacheTTL, 1 );
} elsif ($ARGV[0] eq '--version') {
print "Sanoid version: $version\n";
exit 0;
} elsif ($ARGV[0] eq '--cron' || 1) {
take_snapshots (@params);
prune_snapshots (@params);

View File

@ -4,6 +4,8 @@
# 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.8';
use strict;
use Data::Dumper;
use Time::Local;
@ -11,6 +13,11 @@ use Sys::Hostname;
my %args = getargs(@ARGV);
if ($args{'version'}) {
print "Syncoid version: $version\n";
exit 0;
}
my $rawsourcefs = $args{'source'};
my $rawtargetfs = $args{'target'};
my $debug = $args{'debug'};
@ -162,7 +169,7 @@ sub getargs {
my @args = @_;
my %args;
my $novalueargs = ",debug,nocommandchecks,";
my $novalueargs = ",debug,nocommandchecks,version,";
while (my $arg = shift(@args)) {
if ($arg =~ /^--/) {