Fix sanoid default state

Fixes #134
This commit is contained in:
Charles Pigott 2017-08-15 16:05:06 +01:00
parent f8ea8f907d
commit 5849285815
1 changed files with 9 additions and 1 deletions

10
sanoid
View File

@ -15,12 +15,18 @@ use Getopt::Long qw(:config auto_version auto_help);
use Pod::Usage; # pod2usage
use Time::Local; # to parse dates in reverse
my %args = ("cron" => 1, "verbose" => 1, "configdir" => "/etc/sanoid");
my %args = ("configdir" => "/etc/sanoid");
GetOptions(\%args, "verbose", "debug", "cron", "readonly", "quiet",
"monitor-health", "force-update", "configdir=s",
"monitor-snapshots", "take-snapshots", "prune-snapshots"
) or pod2usage(2);
# If only config directory (or nothing) has been specified, default to --cron --verbose
if (keys %args < 2) {
$args{'cron'} = 1;
$args{'verbose'} = 1;
}
my $pscmd = '/bin/ps';
my $zfs = '/sbin/zfs';
@ -1060,6 +1066,8 @@ sanoid - ZFS snapshot management and replication tool
sanoid [options]
Assumes --cron --verbose if no other arguments (other than configdir) are specified
Options:
--configdir=DIR Specify a directory to find config file sanoid.conf