X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famcleanup.pl;h=14c9fc6273c4bf29f1651173c00366e757eee2db;hb=HEAD;hp=eb1730fc5540ea042d0e6dc5615c97584815fe18;hpb=42ff24f2a525d5965e1841b2ebe3ee0f4b918ac6;p=debian%2Famanda diff --git a/server-src/amcleanup.pl b/server-src/amcleanup.pl index eb1730f..14c9fc6 100644 --- a/server-src/amcleanup.pl +++ b/server-src/amcleanup.pl @@ -1,9 +1,10 @@ #!@PERL@ -# Copyright (c) 2008, 2010 Zmanda, Inc. All Rights Reserved. +# Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved. # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -28,13 +29,15 @@ use Amanda::Paths; use Amanda::Constants; use Amanda::Process; use Amanda::Logfile; - +use Amanda::Holding; +use Amanda::Debug qw( debug ); my $kill_enable=0; my $process_alive=0; my $verbose=0; +my $clean_holding=0; sub usage() { - print "Usage: amcleanup [-k] [-v] [-p] conf\n"; + print "Usage: amcleanup [-k] [-v] [-p] [-r] conf\n"; exit 1; } @@ -42,11 +45,14 @@ Amanda::Util::setup_application("amcleanup", "server", $CONTEXT_CMDLINE); my $config_overrides = new_config_overrides($#ARGV+1); +debug("Arguments: " . join(' ', @ARGV)); Getopt::Long::Configure(qw(bundling)); GetOptions( + 'version' => \&Amanda::Util::version_opt, 'k' => \$kill_enable, 'p' => \$process_alive, 'v' => \$verbose, + 'r' => \$clean_holding, 'help|usage' => \&usage, 'o=s' => sub { add_config_override_opt($config_overrides, $_[1]); }, ) or usage(); @@ -73,7 +79,7 @@ my $logdir=config_dir_relative(getconf($CNF_LOGDIR)); my $logfile = "$logdir/log"; my $amreport="$sbindir/amreport"; my $amtrmidx="$amlibexecdir/amtrmidx"; -my $amcleanupdisk="$amlibexecdir/amcleanupdisk"; +my $amcleanupdisk="$sbindir/amcleanupdisk"; if ( ! -e "$CONFIG_DIR/$config_name" ) { die "Configuration directory '$CONFIG_DIR/$config_name' doesn't exist\n"; @@ -195,10 +201,11 @@ foreach my $pname ("amdump", "amflush") { } } -if ($verbose) { - system $amcleanupdisk, "-v", $config_name; -} else { - system $amcleanupdisk, $config_name; -} +my @amcleanupdisk; +push @amcleanupdisk, $amcleanupdisk; +push @amcleanupdisk, "-v" if $verbose; +push @amcleanupdisk, "-r" if $clean_holding; +push @amcleanupdisk, $config_name; +system @amcleanupdisk; Amanda::Util::finish_application();