aboutsummaryrefslogtreecommitdiff
path: root/beam
diff options
context:
space:
mode:
Diffstat (limited to 'beam')
-rwxr-xr-xbeam49
1 files changed, 49 insertions, 0 deletions
diff --git a/beam b/beam
new file mode 100755
index 0000000..48a9ebd
--- /dev/null
+++ b/beam
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+use App::Beam::Backup;
+use Pod::Usage;
+use Pod::Man;
+use File::Basename;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case require_order);
+use Unix::Sysexits;
+use Data::Dumper;
+
+my $progname = basename($0);
+my $progdescr = 'backup manager';
+my %args;
+
+GetOptions("h" => sub {
+ pod2usage(-message => "$progname: $progdescr",
+ -exitstatus => EX_OK);
+ },
+ "help" => sub {
+ pod2usage(-exitstatus => EX_OK, -verbose => 2);
+ },
+ "usage" => sub {
+ pod2usage(-exitstatus => EX_OK, -verbose => 0);
+ },
+ "debug|d" => sub { $args{debug}++ },
+ "dry-run|n" => sub { $args{dry_run} = 1 },
+ "config-file|f=s" => sub { $args{config} = $_[1] }
+) or exit(EX_USAGE);
+
+unless (@ARGV) {
+ print STDERR "$progname: no command name\n";
+ exit(EX_USAGE);
+}
+
+my %ctab = (
+ backup => sub {
+ return new App::Beam::Backup(@_);
+ }
+);
+
+unless (defined($ctab{$ARGV[0]})) {
+ print STDERR "$progname: no such command\n";
+ exit(EX_USAGE);
+}
+my $beam = $ctab{$ARGV[0]}(%args);
+$beam->begin;
+$beam->run(@ARGV);
+$beam->end;

Return to:

Send suggestions and report system problems to the System administrator.