Subversion Repositories zfs_utils

Rev

Rev 51 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51 Rev 57
Line 351... Line 351...
351
exit 1 unless keys %$config;
351
exit 1 unless keys %$config;
352
 
352
 
353
# parse CLI options
353
# parse CLI options
354
GetOptions( $config,
354
GetOptions( $config,
355
   'dryrun|n',
355
   'dryrun|n',
356
   'verbose|v+',
356
   'verbosity|v+',
357
   'version|V',
357
   'version|V',
358
   'help|h',
358
   'help|h',
359
) or do { print "Invalid options\n"; exit 2 };
359
) or do { print "Invalid options\n"; exit 2 };
360
if (defined ($config->{help})) {
360
if (defined ($config->{help})) {
361
   print "Usage: $FindBin::Script [--dryrun] [--verbose] [--help]\n";
361
   print "Usage: $FindBin::Script [--dryrun] [--verbosity] [--help]\n";
362
   print "  --dryrun, -n   Run in dry-run mode (no writes)\n";
362
   print "  --dryrun, -n   Run in dry-run mode (no writes)\n";
363
   print "  --verbose, -v  Run in verbose mode (more v's mean more verbose)\n";
363
   print "  --verbosity, -v  Run in verbose mode (more v's mean more verbose)\n";
364
   print "  --version, -V  Display version number\n";
364
   print "  --version, -V  Display version number\n";
365
   exit 0;
365
   exit 0;
366
} elsif (defined $config->{version}) {
366
} elsif (defined $config->{version}) {
367
   print "$FindBin::Script v$VERSION\n";
367
   print "$FindBin::Script v$VERSION\n";
368
   exit 0;
368
   exit 0;
369
}
369
}
370
 
370
 
371
# set some defaults in library from config
371
# set some defaults in library from config
372
$verboseLoggingLevel = $config->{verbose} // 0;
372
$verboseLoggingLevel = $config->{verbosity} // 0;
373
# status file path
373
# status file path
374
$config->{'status_file'} //= "$scriptFullPath.status";
374
$config->{'status_file'} //= "$scriptFullPath.status";
375
# set log file name for sub logMsg in ZFS_Utils, and remove the old log if it exists
375
# set log file name for sub logMsg in ZFS_Utils, and remove the old log if it exists
376
# Log file is only valid for one run
376
# Log file is only valid for one run
377
$logFileName = $config->{'log_file'} //= "$scriptFullPath.log";
377
$logFileName = $config->{'log_file'} //= "$scriptFullPath.log";