From 9079ccbf5f1b091df68487b36778bad90e08638b Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 13 Feb 2012 15:14:39 +0000 Subject: [PATCH] JAM: updated data2tape script from newer version in lxhadeb03/bin --- disks/daq_disks | Bin 45874 -> 46114 bytes disks/data2tape.pl | 63 +++++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/disks/daq_disks b/disks/daq_disks index 427eb15ead253f5248b75f58f4e872c26ae4ba4e..2eeb2f34ea7c193e38eee04b25cf8dc34a28aa7c 100755 GIT binary patch delta 4631 zcmb_gdvH|M8Nc7XclX}Adp9iP67nM1cDh-)V5QgwvJAty-tG1uV%<9nVT@FhK)%#9>QcAdofY)9!zQ=pC?TZ z^jx==*8;m4>88QU+gS>X7nQZyGhc?KQqQAF-{TRVitZbGdY60S^7z%gJ>AQeR+UeQ zSJw2dxbC`Js^eXK%O_XIn>!jBTl>VprNxy!&R1TpJaC~)e3B6X@}8Hh(XgZ zaRz?F^fr~d`Nk|n+Q>%w!ZlK4SAF>a#17U58uzehX0tXL_(2*eiuEZM6Sx&>)m5yy z93^lY;-{&usf7B2c^AQIulOLDm--2d!5G~1Pk1ou>oJ-wJVt0Sk7+1b8PUwCOtY|` zHPI}{F7(mk5Q`p#iGDS&nHRw)WSWTsJX^1FCFV@jib@^>nzceAT?s|a+PCM!s+TJ? zlZXeaP>@lbhjgnE39dj|S$x!N%3y0RaPv0;xA=jrM)BvmjFe2h@EaB#=PfShaONT} zg=xJBbmb12K59LQgjabe6Fcd;4GG^tjosKN*NED$-Usz4Zo9b(%|+>@@a>UtQ{3v2 zYs{&iu~qbU$Z)9?T{v8J4=bWg(AJ|*qn6&VRx#(j4eiB9v>2O=oCTxYq1N}jVk(7 zRMU&NBTXysCZ3~hh!{(ts;9-w`grOnCmgb}PeFg0)mBkEi`e-OfyyTF$j4;u=0sKn z5^3&6vPScXT2*J*RCBkIl1_$+5N4Fkejkbt^W@yeLpVxaaf(yN>*3M#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4`71A$@|1@0LR1d3T4z?1`l zVwME3-hn_dO9R;AK%bb&0CqUgCuSMNczw<5cA!tpa>`M#&w)NMD}pTzI%xyI8v}fl90(M%i7FMrv*bX#nu}EV&?gS` ziP=KcY}P&2Co$*~^XZ7vC*}z>CAtNi&-wky5>W^g^Lf8NR&=wxZDkW}l)qY8MA`CB zE6cKp&jwwAGw=X^m_#;}%Yv@bN!P(V1>eGdV{_IkeA;LVqO!9Xwka=QJwr~qUG{aA z#?|GR3G;D8JtGfvO{UZG<*un@?Ol~}{7)keSl(N*X;nGxlp9yM>GwhI;9%SOOHJ4C z$N?K+j0MJd-O5;qD>S?Zn;|O16&l_ffHyfHEPWuhG0;Sc87$hs`%iJ&SAH>9uN&xJ zy{2+<)pYd}TBf^A{sEmI`SLgQ=wSDeaD`MfD1qpo88LnmFDdw+zQPv#{>~WPvF;0_ z;@kgMj{Iz3DxV=CWXp!)(Yp1;dh}xE@v>*IcJ$AKj~0v$-&-H0tL5AKrc<%Z+CL|9 zeJ?VF_-jb6*gq}SJ>bI`+#Mmu>N)c0{-iy!!MENi-`+o6E4WE!ADFEj+#wh9klZEr T@=$+3p5|fr2cy{|@#6mg^yQ(! diff --git a/disks/data2tape.pl b/disks/data2tape.pl index b7ebac2..e959c5d 100755 --- a/disks/data2tape.pl +++ b/disks/data2tape.pl @@ -15,13 +15,18 @@ my $opt_endDate; my @prefix_list = (); my @file_list; my $file_list_aref = \@file_list; +my $opt_file; my $opt_arch; +my $opt_dir = "hld"; GetOptions ('h|help' => \$opt_help, + 'f|file=s' => \$opt_file, 's|start=s' => \$opt_startDate, 'e|end=s' => \$opt_endDate, 'p|prefix=s' => \@prefix_list, - 'a|arch=s' => \$opt_arch); + 'a|arch=s' => \$opt_arch, + 'd|dir=s' => \$opt_dir + ); if( $opt_help ) { &help(); @@ -32,11 +37,12 @@ if(-1 == &checkArgs()){ exit(0); } -my $startSec = &date2sec($opt_startDate); -my $endSec = &date2sec($opt_endDate); - -&getFileList(); - +if(defined $opt_file){ + &getFileListFromFile(); +} +else{ + &getFileList(); +} &archive(); exit(0); @@ -59,12 +65,17 @@ Usage: [-s|--start ] : Beginning of time interval. [-t|--end ] : End of time interval. [-p|--prefix ] : Archive only these prefixes. + [-f|--file ] : Path to hld file list. [-a|--arch ] : Archiving is done only with this option enabled. + [-d|--dir ] : Path to the file in the archive. Examples: Archive all hld files with prefixes 'st' and 'be' from sept 4th, 2010 to the archive hadessep10raw: - date2tape.pl -p be -p st -s 2010-09-04_00:00:00 -e 2010-09-04_23:59:59 -a hadessep10raw + date2tape.pl -p be -p st -s 2010-09-04_00:00:00 -e 2010-09-04_23:59:59 -a hadessep10raw + + Archive all hld files from the list /home/hadaq/kgoebel.txt to archive "hadesuser/kgoebel/hld/": + date2tape.pl -a hadesuser -d kgoebel/hld -f /home/hadaq/kgoebel.txt EOF } @@ -73,14 +84,16 @@ sub checkArgs() { my $retval = 0; - unless( defined $opt_startDate ){ - print "Start date is not given!\n"; - $retval = -1; - } - - unless( defined $opt_endDate ){ - print "End date is not given!\n"; - $retval = -1; + unless( defined $opt_file ){ + unless( defined $opt_startDate ){ + print "Start date is not given!\n"; + $retval = -1; + } + + unless( defined $opt_endDate ){ + print "End date is not given!\n"; + $retval = -1; + } } return $retval; @@ -113,8 +126,26 @@ sub date2sec() return $sec_epoch; } +sub getFileListFromFile() +{ + #- Get file list from $opt_file + + my @tmp_list = `cat $opt_file`; + + foreach my $file (@tmp_list){ + chomp($file); + $file =~ s/^\s+//; # remove leading spaces + $file =~ s/\s+$//; # remove trailing spaces + + push(@file_list, $file); + } +} + sub getFileList() { + my $startSec = &date2sec($opt_startDate); + my $endSec = &date2sec($opt_endDate); + #- Loop over disks foreach my $diskNr (1..22){ my $path = sprintf("/data%02d/data", $diskNr); @@ -166,7 +197,7 @@ sub archive() my $archive = "archive"; $archive = $opt_arch if( defined $opt_arch); - my $cmd = "gstore arch \"$hldfile\" $archive \"hld\""; + my $cmd = "gstore arch \"$hldfile\" $archive \"$opt_dir\""; print "cmd: $cmd\n"; system($cmd) if( defined $opt_arch); } -- 2.43.0