From ef6e985bf26a2d4961b33c36356966957ac8e52d Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 29 Nov 2010 13:46:39 +0000 Subject: [PATCH] *** empty log message *** --- disks/data2tape.pl | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/disks/data2tape.pl b/disks/data2tape.pl index 61f7638..4508ae7 100755 --- a/disks/data2tape.pl +++ b/disks/data2tape.pl @@ -12,17 +12,16 @@ use File::Basename; my $opt_help = 0; my $opt_startDate; my $opt_endDate; -my @prefix_list = ("be"); +my @prefix_list = (); my @file_list; my $file_list_aref = \@file_list; -my $archive = "hadessep10raw"; -my $opt_arch = 0; +my $opt_arch; GetOptions ('h|help' => \$opt_help, 's|start=s' => \$opt_startDate, 'e|end=s' => \$opt_endDate, 'p|prefix=s' => \@prefix_list, - 'a|arch' => \$opt_arch); + 'a|arch=s' => \$opt_arch); if( $opt_help ) { &help(); @@ -60,7 +59,7 @@ Usage: [-s|--start ] : Beginning of time interval. [-t|--end ] : End of time interval. [-p|--prefix ] : Archive only these prefixes. - [-a|--arch] : Archiving is done only with this option enabled. + [-a|--arch ] : Archiving is done only with this option enabled. Examples: @@ -124,8 +123,8 @@ sub getFileList() foreach my $hldfile (@data){ - #- File size must be above 1kB - next if(stat($hldfile)->size < 1024); + #- File size must be above 1 MB + next if(stat($hldfile)->size < 1024000); #- Check prefix if($hldfile =~ /(\w{2})\d+\.hld/){ @@ -154,16 +153,22 @@ sub archive() print "Number of files to archive: $nrOfFiles\n\n"; - if($opt_arch){ - print "The data will be written to the $archive archive!\n"; + #- Return if nrOfFiles is zero + return 0 unless($nrOfFiles); + + if(defined $opt_arch){ + print "The data will be written to the $opt_arch archive!\n"; &askUser(); } foreach my $hldfile (@file_list){ + + my $archive = "archive"; + $archive = $opt_arch if( defined $opt_arch); my $cmd = "gstore arch \"$hldfile\" $archive \"hld\""; print "cmd: $cmd\n"; - system($cmd) if($opt_arch); + system($cmd) if( defined $opt_arch); } } -- 2.43.0