annotate archiver.pl @ 52:b762b5af6e42

fixed problem with user recogintion by getlogin
author casties
date Wed, 10 Sep 2008 14:59:45 +0200
parents 8b9d91963de7
children 2208ed7370cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
1 #!/usr/local/bin/perl -w
30497c6a3eca Initial revision
casties
parents:
diff changeset
2
30497c6a3eca Initial revision
casties
parents:
diff changeset
3 use strict;
30497c6a3eca Initial revision
casties
parents:
diff changeset
4
30497c6a3eca Initial revision
casties
parents:
diff changeset
5 use XML::LibXML;
30497c6a3eca Initial revision
casties
parents:
diff changeset
6
30497c6a3eca Initial revision
casties
parents:
diff changeset
7 # MPIWG libraries
30497c6a3eca Initial revision
casties
parents:
diff changeset
8 use lib '/usr/local/mpiwg/archive';
30497c6a3eca Initial revision
casties
parents:
diff changeset
9 use MPIWGStor;
30497c6a3eca Initial revision
casties
parents:
diff changeset
10
30497c6a3eca Initial revision
casties
parents:
diff changeset
11 # make output unbuffered
30497c6a3eca Initial revision
casties
parents:
diff changeset
12 $|=1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
13
30497c6a3eca Initial revision
casties
parents:
diff changeset
14 #######################################################
30497c6a3eca Initial revision
casties
parents:
diff changeset
15 # internal parameters
30497c6a3eca Initial revision
casties
parents:
diff changeset
16 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
17
30497c6a3eca Initial revision
casties
parents:
diff changeset
18 # program version
52
b762b5af6e42 fixed problem with user recogintion by getlogin
casties
parents: 25
diff changeset
19 my $version = "0.7.3 (ROC 10.9.2008)";
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
20
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
21 # short help
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
22 my $help = "MPIWG archiver $version
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
23 use: archiver [options] docpath
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
24 options:
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
25 -debug show debugging info
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
26 -premigrate don't delete archived files
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
27 -force archive even if already archived
25
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
28 -replace rewrite index file
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
29 ";
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
30
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
31 # read command line parameters
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
32 my $args = MPIWGStor::parseargs;
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
33 if (! scalar(%$args)) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
34 print $help, "\n";
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
35 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
36 }
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
37
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
38 # debug level
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
39 $debug = (exists $$args{'debug'}) ? $$args{'debug'} : 0;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
40
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
41 # force archiving
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
42 my $force_archive = (exists $$args{'force'}) ? $$args{'force'} : 0;
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
43
25
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
44 # rewrite index file
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
45 my $rewrite_index = (exists $$args{'replace'}) ? $$args{'replace'} : 0;
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
46
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
47 # rewrite XML file (necessary for archive date!)
30497c6a3eca Initial revision
casties
parents:
diff changeset
48 my $fix_xml = 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
49 my $xml_changed = 0;
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
50
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
51 # XML namespace (not really implemented!)
30497c6a3eca Initial revision
casties
parents:
diff changeset
52 my $namespace = "";
30497c6a3eca Initial revision
casties
parents:
diff changeset
53
30497c6a3eca Initial revision
casties
parents:
diff changeset
54 # archive name (archive-path element, usually == $docdir)
30497c6a3eca Initial revision
casties
parents:
diff changeset
55 my $archname;
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
56
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
57 # archive storage date (now)
30497c6a3eca Initial revision
casties
parents:
diff changeset
58 my $archdate = stime(time);
30497c6a3eca Initial revision
casties
parents:
diff changeset
59
30497c6a3eca Initial revision
casties
parents:
diff changeset
60 # delete "junk" files before archiving
30497c6a3eca Initial revision
casties
parents:
diff changeset
61 my $delete_junk_files = 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
62
30497c6a3eca Initial revision
casties
parents:
diff changeset
63 # delete data files after archiving
30497c6a3eca Initial revision
casties
parents:
diff changeset
64 my $delete_data_files = 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
65
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
66 # don't delete archived files with "-premigrate"
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
67 if (exists $$args{'premigrate'}) {
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
68 $delete_data_files = not $$args{'premigrate'};
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
69 }
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
70 if ($delete_data_files) {
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
71 logger('INFO', "going to remove successfully archived files from disk");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
72 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
73
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
74
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
75 #######################################################
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
76 # external programs
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
77 #
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
78 my $archprog = "/opt/tivoli/tsm/client/ba/bin/dsmc";
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
79 if (! -x $archprog) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
80 logger('ABORT', "TSM client program '$archprog' missing!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
81 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
82 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
83 my $checkprog = "/usr/local/mpiwg/archive/metacheck";
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
84 if (! -x $checkprog) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
85 logger('ABORT', "meta data checking program '$checkprog' missing!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
86 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
87 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
88 # log file for archiver
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
89 my $log_file = "/var/log/mpiwg-archiver.log";
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
90 if (! open LOG, ">>$log_file") {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
91 logger('ABORT', "unable to write log file '$log_file'!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
92 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
93 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
94
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
95 #######################################################
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
96 # check parameters that were passed to the program
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
97 #
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
98
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
99 my $docdir = $$args{'path'};
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
100 # strip double slashes
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
101 $docdir =~ s/\/\//\//;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
102 # strip trailing slashes
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
103 $docdir =~ s/\/+$//;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
104 if (! -d $docdir) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
105 logger('ABORT', "document directory \'$docdir\' doesn't exist!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
106 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
107 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
108
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
109 my $metafile = "$docdir/index.meta";
30497c6a3eca Initial revision
casties
parents:
diff changeset
110 if (! -f $metafile) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
111 logger('ABORT', "metadata index file \'$metafile\' doesn't exist!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
112 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
113 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
114
30497c6a3eca Initial revision
casties
parents:
diff changeset
115 #######################################################
30497c6a3eca Initial revision
casties
parents:
diff changeset
116 # internal variables
30497c6a3eca Initial revision
casties
parents:
diff changeset
117 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
118
30497c6a3eca Initial revision
casties
parents:
diff changeset
119 # number of errors
30497c6a3eca Initial revision
casties
parents:
diff changeset
120 my $errcnt = 0;
30497c6a3eca Initial revision
casties
parents:
diff changeset
121 # number of warnings
30497c6a3eca Initial revision
casties
parents:
diff changeset
122 my $warncnt = 0;
30497c6a3eca Initial revision
casties
parents:
diff changeset
123
30497c6a3eca Initial revision
casties
parents:
diff changeset
124 #######################################################
30497c6a3eca Initial revision
casties
parents:
diff changeset
125 # subroutines
30497c6a3eca Initial revision
casties
parents:
diff changeset
126 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
127
30497c6a3eca Initial revision
casties
parents:
diff changeset
128 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
129 # $files = read_resource_meta($rootnode)
30497c6a3eca Initial revision
casties
parents:
diff changeset
130 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
131 # checks general resource meta information and reads the list of files
30497c6a3eca Initial revision
casties
parents:
diff changeset
132 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
133 sub read_resource_meta {
30497c6a3eca Initial revision
casties
parents:
diff changeset
134 my ($rootnode) = @_;
30497c6a3eca Initial revision
casties
parents:
diff changeset
135 my %files;
30497c6a3eca Initial revision
casties
parents:
diff changeset
136 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
137 # archive path
30497c6a3eca Initial revision
casties
parents:
diff changeset
138 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
139 # get archive-path
30497c6a3eca Initial revision
casties
parents:
diff changeset
140 $archname = MPIWGStor::sstrip($rootnode->findvalue('child::archive-path'));
30497c6a3eca Initial revision
casties
parents:
diff changeset
141 if (! $archname) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
142 logger('ABORT', "archive-name element missing!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
143 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
144 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
145
30497c6a3eca Initial revision
casties
parents:
diff changeset
146 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
147 # files
30497c6a3eca Initial revision
casties
parents:
diff changeset
148 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
149 my @filenodes = $rootnode->findnodes('child::file');
30497c6a3eca Initial revision
casties
parents:
diff changeset
150 foreach my $fn (@filenodes) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
151 my $name = MPIWGStor::sstrip($fn->findvalue('child::name'));
30497c6a3eca Initial revision
casties
parents:
diff changeset
152 my $path = MPIWGStor::sstrip($fn->findvalue('child::path'));
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
153 logger('DEBUG', "FILE ($path)$name");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
154 my $f = ($path) ? "$path/$name" : "$name";
30497c6a3eca Initial revision
casties
parents:
diff changeset
155 $files{$f} = $name;
30497c6a3eca Initial revision
casties
parents:
diff changeset
156 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
157
30497c6a3eca Initial revision
casties
parents:
diff changeset
158 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
159 # archive-storage-date
30497c6a3eca Initial revision
casties
parents:
diff changeset
160 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
161 my $stordatenode = ($rootnode->find('child::archive-storage-date'))->get_node(1);
30497c6a3eca Initial revision
casties
parents:
diff changeset
162 if ($stordatenode) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
163 logger('WARNING', "archive storage date exists! Resource already archived?");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
164 $warncnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
165 # delete old date
30497c6a3eca Initial revision
casties
parents:
diff changeset
166 $stordatenode->removeChildNodes;
30497c6a3eca Initial revision
casties
parents:
diff changeset
167 } else {
30497c6a3eca Initial revision
casties
parents:
diff changeset
168 # create new storage date node
30497c6a3eca Initial revision
casties
parents:
diff changeset
169 $stordatenode = $rootnode->addNewChild($namespace, "archive-storage-date");
30497c6a3eca Initial revision
casties
parents:
diff changeset
170 # move after archive-path
30497c6a3eca Initial revision
casties
parents:
diff changeset
171 $rootnode->insertAfter($stordatenode, ($rootnode->find('child::archive-path'))->get_node(1));
30497c6a3eca Initial revision
casties
parents:
diff changeset
172 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
173 $stordatenode->appendTextNode($archdate);
30497c6a3eca Initial revision
casties
parents:
diff changeset
174 $xml_changed++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
175 return \%files;
30497c6a3eca Initial revision
casties
parents:
diff changeset
176 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
177
30497c6a3eca Initial revision
casties
parents:
diff changeset
178
30497c6a3eca Initial revision
casties
parents:
diff changeset
179 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
180 # $%files = run_archive
30497c6a3eca Initial revision
casties
parents:
diff changeset
181 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
182 # runs the archiver program on $docdir and returns a list of archived files
30497c6a3eca Initial revision
casties
parents:
diff changeset
183 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
184 sub run_archive {
30497c6a3eca Initial revision
casties
parents:
diff changeset
185 my %files;
30497c6a3eca Initial revision
casties
parents:
diff changeset
186 print LOG "START archiver $version $archdate\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
187 my $archcmd = $archprog;
30497c6a3eca Initial revision
casties
parents:
diff changeset
188 $archcmd .= " archive -archsymlinkasfile=no -subdir=yes";
30497c6a3eca Initial revision
casties
parents:
diff changeset
189 $archcmd .= " -description='$archname'";
30497c6a3eca Initial revision
casties
parents:
diff changeset
190 $archcmd .= " '$docdir/'";
30497c6a3eca Initial revision
casties
parents:
diff changeset
191
30497c6a3eca Initial revision
casties
parents:
diff changeset
192 print LOG "CMD: $archcmd\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
193 if (open ARCH, "$archcmd 2>&1 |") {
30497c6a3eca Initial revision
casties
parents:
diff changeset
194 while (<ARCH>) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
195 chomp;
30497c6a3eca Initial revision
casties
parents:
diff changeset
196 print LOG "ARCH: $_\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
197 if (/Normal File-->\s+[\d,]+\s+(.*)\s+\[Sent\]/) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
198 print " ARCH: file '$1'\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
199 $files{$1} = "ok";
30497c6a3eca Initial revision
casties
parents:
diff changeset
200 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
201 if (/^Archive processing of .* finished without failure./) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
202 print " ARCH: OK\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
203 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
204 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
205 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
206 logger('ABORT', "unable to start archive command '$archcmd'!!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
207 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
208 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
209
30497c6a3eca Initial revision
casties
parents:
diff changeset
210 return \%files;
30497c6a3eca Initial revision
casties
parents:
diff changeset
211 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
212
30497c6a3eca Initial revision
casties
parents:
diff changeset
213
30497c6a3eca Initial revision
casties
parents:
diff changeset
214 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
215 # check_files(\%files_to_archive, \%archived_files)
30497c6a3eca Initial revision
casties
parents:
diff changeset
216 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
217 # compares the list of archived and to be archived files
30497c6a3eca Initial revision
casties
parents:
diff changeset
218 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
219 sub check_files {
30497c6a3eca Initial revision
casties
parents:
diff changeset
220 my ($to_archive, $archived) = @_;
30497c6a3eca Initial revision
casties
parents:
diff changeset
221
30497c6a3eca Initial revision
casties
parents:
diff changeset
222 my $nt = scalar keys %$to_archive;
30497c6a3eca Initial revision
casties
parents:
diff changeset
223 my $na = scalar keys %$archived;
30497c6a3eca Initial revision
casties
parents:
diff changeset
224
30497c6a3eca Initial revision
casties
parents:
diff changeset
225 foreach my $ft (sort keys %$to_archive) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
226 my $fp = "$docdir/$ft";
30497c6a3eca Initial revision
casties
parents:
diff changeset
227 #print " fp: $fp\n";
30497c6a3eca Initial revision
casties
parents:
diff changeset
228 if ($$archived{$fp}) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
229 logger('DEBUG', "$ft archived OK");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
230 $$archived{$fp} = "OK";
30497c6a3eca Initial revision
casties
parents:
diff changeset
231 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
232 logger('ERROR', "file '$ft' missing from archive!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
233 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
234 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
235 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
236
30497c6a3eca Initial revision
casties
parents:
diff changeset
237 foreach my $fa (sort keys %$archived) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
238 if ($$archived{$fa} ne "OK") {
30497c6a3eca Initial revision
casties
parents:
diff changeset
239 my ($fn, $fp) = MPIWGStor::split_file_path($fa);
30497c6a3eca Initial revision
casties
parents:
diff changeset
240 if ($MPIWGStor::index_files{$fn}) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
241 logger('DEBUG', "$fa ignored");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
242 $na--;
30497c6a3eca Initial revision
casties
parents:
diff changeset
243 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
244 logger('WARNING', "$fa archived but not in list!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
245 $warncnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
246 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
247 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
248 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
249
30497c6a3eca Initial revision
casties
parents:
diff changeset
250 if ($nt > $na) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
251 logger('WARNING', "less files were archived ($na vs. $nt)!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
252 } elsif ($na > $nt) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
253 logger('WARNING', "more files were archived ($na vs. $nt)!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
254 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
255
30497c6a3eca Initial revision
casties
parents:
diff changeset
256 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
257
30497c6a3eca Initial revision
casties
parents:
diff changeset
258
30497c6a3eca Initial revision
casties
parents:
diff changeset
259 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
260 # delete_files(\%files)
30497c6a3eca Initial revision
casties
parents:
diff changeset
261 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
262 # deletes the files from the list (of absolute files) and their directories
30497c6a3eca Initial revision
casties
parents:
diff changeset
263 # if they are empty
30497c6a3eca Initial revision
casties
parents:
diff changeset
264 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
265 sub delete_files {
30497c6a3eca Initial revision
casties
parents:
diff changeset
266 my ($files) = @_;
30497c6a3eca Initial revision
casties
parents:
diff changeset
267 my %dirs;
30497c6a3eca Initial revision
casties
parents:
diff changeset
268
30497c6a3eca Initial revision
casties
parents:
diff changeset
269 foreach my $f (sort keys %$files) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
270 my ($fn, $fp) = MPIWGStor::split_file_path($f);
30497c6a3eca Initial revision
casties
parents:
diff changeset
271 # collect all unique directories
30497c6a3eca Initial revision
casties
parents:
diff changeset
272 if ($fp && (! $dirs{$fp})) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
273 $dirs{$fp} = $fp;
30497c6a3eca Initial revision
casties
parents:
diff changeset
274 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
275 # don't delete index files
30497c6a3eca Initial revision
casties
parents:
diff changeset
276 next if ($MPIWGStor::index_files{$fn});
30497c6a3eca Initial revision
casties
parents:
diff changeset
277 # no file no delete
30497c6a3eca Initial revision
casties
parents:
diff changeset
278 next unless (-f $f);
30497c6a3eca Initial revision
casties
parents:
diff changeset
279 # delete files
30497c6a3eca Initial revision
casties
parents:
diff changeset
280 if (unlink $f) {
23
a3c35eae25dc added count in archivemany
casties
parents: 18
diff changeset
281 logger('DEBUG', "remove $f ($fn)");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
282 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
283 logger('ERROR', "unable to delete $f!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
284 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
285 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
286 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
287 # try to delete all empty directories
30497c6a3eca Initial revision
casties
parents:
diff changeset
288 my @dirkeys = sort keys %dirs;
30497c6a3eca Initial revision
casties
parents:
diff changeset
289 # starting at the end to get to the subdirectories first
30497c6a3eca Initial revision
casties
parents:
diff changeset
290 for (my $i = $#dirkeys; $i >= 0; $i--) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
291 my $d = $dirkeys[$i];
30497c6a3eca Initial revision
casties
parents:
diff changeset
292 # dont't remove document dir (shouldn't be empty anyway)
30497c6a3eca Initial revision
casties
parents:
diff changeset
293 next if ($d eq $docdir);
30497c6a3eca Initial revision
casties
parents:
diff changeset
294 if (-d $d) {
23
a3c35eae25dc added count in archivemany
casties
parents: 18
diff changeset
295 logger('DEBUG', "remove dir $d");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
296 rmdir $d;
30497c6a3eca Initial revision
casties
parents:
diff changeset
297 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
298 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
299 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
300
30497c6a3eca Initial revision
casties
parents:
diff changeset
301
30497c6a3eca Initial revision
casties
parents:
diff changeset
302 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
303 # delete_all_files(\%files, $dir)
30497c6a3eca Initial revision
casties
parents:
diff changeset
304 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
305 # deletes all files with names from the list %files
30497c6a3eca Initial revision
casties
parents:
diff changeset
306 # in the directory $dir and its subdirectories
30497c6a3eca Initial revision
casties
parents:
diff changeset
307 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
308 sub delete_all_files {
30497c6a3eca Initial revision
casties
parents:
diff changeset
309 my ($files, $dir) = @_;
30497c6a3eca Initial revision
casties
parents:
diff changeset
310
30497c6a3eca Initial revision
casties
parents:
diff changeset
311 if (! opendir DIR, $dir) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
312 logger('ERROR', "unable to read directory $dir!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
313 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
314 return;
30497c6a3eca Initial revision
casties
parents:
diff changeset
315 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
316 my @fl = readdir DIR;
30497c6a3eca Initial revision
casties
parents:
diff changeset
317 closedir DIR;
30497c6a3eca Initial revision
casties
parents:
diff changeset
318
30497c6a3eca Initial revision
casties
parents:
diff changeset
319 foreach my $f (@fl) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
320 next if ($f =~ /^\.{1,2}$/);
30497c6a3eca Initial revision
casties
parents:
diff changeset
321 if ($$files{$f}) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
322 # $f is in the file list
30497c6a3eca Initial revision
casties
parents:
diff changeset
323 if (-f "$dir/$f") {
30497c6a3eca Initial revision
casties
parents:
diff changeset
324 # $f is a file
30497c6a3eca Initial revision
casties
parents:
diff changeset
325 if (unlink "$dir/$f") {
23
a3c35eae25dc added count in archivemany
casties
parents: 18
diff changeset
326 logger('DEBUG', "removed $f");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
327 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
328 logger('ERROR', "unable to delete $f!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
329 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
330 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
331 } elsif (-d _) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
332 # $f is a directory (unlink won't work)
30497c6a3eca Initial revision
casties
parents:
diff changeset
333 if ((system 'rm', '-r', "$dir/$f") == 0) {
23
a3c35eae25dc added count in archivemany
casties
parents: 18
diff changeset
334 logger('DEBUG', "removed directory $f");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
335 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
336 logger('ERROR', "unable to delete directory $f!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
337 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
338 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
339 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
340 logger('ERROR', "funny object $dir/$f!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
341 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
342 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
343 } else {
30497c6a3eca Initial revision
casties
parents:
diff changeset
344 # $f is not in the list
30497c6a3eca Initial revision
casties
parents:
diff changeset
345 if (-d "$dir/$f") {
30497c6a3eca Initial revision
casties
parents:
diff changeset
346 # recurse into directories
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
347 logger('DEBUG', "enter $dir/$f");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
348 delete_all_files($files, "$dir/$f");
30497c6a3eca Initial revision
casties
parents:
diff changeset
349 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
350 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
351 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
352 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
353
30497c6a3eca Initial revision
casties
parents:
diff changeset
354
30497c6a3eca Initial revision
casties
parents:
diff changeset
355 #######################################################
30497c6a3eca Initial revision
casties
parents:
diff changeset
356 # main
30497c6a3eca Initial revision
casties
parents:
diff changeset
357 #
30497c6a3eca Initial revision
casties
parents:
diff changeset
358
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
359 logger('START', "archiver $version at $archdate");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
360
30497c6a3eca Initial revision
casties
parents:
diff changeset
361 # make shure the right user is running this program
52
b762b5af6e42 fixed problem with user recogintion by getlogin
casties
parents: 25
diff changeset
362 my $user = getlogin || getpwuid($<);
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
363 if (($user ne "archive")&&($user ne "root")) {
23
a3c35eae25dc added count in archivemany
casties
parents: 18
diff changeset
364 logger("WARNING", "you ($user) should be archive or root user to run this program!");
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
365 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
366
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
367 # check for .archived file
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
368 if (-f "$docdir/.archived") {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
369 if (not $force_archive) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
370 logger('ABORT', "already archived! (.archived file exists)");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
371 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
372 } else {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
373 logger('WARNING', "resource already archived? (.archived file exists)");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
374 $warncnt++;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
375 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
376 }
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
377
30497c6a3eca Initial revision
casties
parents:
diff changeset
378 # use metacheck first
25
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
379 my $check_opts="-add-files";
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
380 if ($rewrite_index) {
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
381 $check_opts = "-replace";
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
382 }
8b9d91963de7 more option passing to metacheck from archivemany via archiver
casties
parents: 23
diff changeset
383 if (open CHECK, "$checkprog $check_opts $docdir |") {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
384 my @errors;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
385 my $msg;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
386 while (<CHECK>) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
387 chomp;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
388 if (/^ERROR/) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
389 push @errors, $_;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
390 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
391 $msg = $_;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
392 }
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
393 if ($msg =~ /^DONE/) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
394 logger('DEBUG', "checking index file: $msg");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
395 logger('INFO', "resource '$docdir' check OK");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
396 } else {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
397 logger('DEBUG', "errors checking index file:\n " . join("\n ", @errors) . "\n $msg");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
398 logger('ABORT', "resource '$docdir' check failed!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
399 exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
400 }
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
401 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
402 logger('ABORT', "unable to run $checkprog");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
403 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
404 }
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
405 # if (system("$checkprog $docdir >/dev/null") == 0) {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
406 # logger('INFO', "resource '$docdir' check OK");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
407 # } else {
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
408 # logger('ABORT', "resource '$docdir' check failed!!");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
409 # exit 1;
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
410 # }
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
411
30497c6a3eca Initial revision
casties
parents:
diff changeset
412 # read index.meta file
30497c6a3eca Initial revision
casties
parents:
diff changeset
413 my ($document, $rootnode) = MPIWGStor::read_xml($metafile);
30497c6a3eca Initial revision
casties
parents:
diff changeset
414
30497c6a3eca Initial revision
casties
parents:
diff changeset
415 # check file and add archive date
30497c6a3eca Initial revision
casties
parents:
diff changeset
416 my $files_to_archive = read_resource_meta($rootnode);
30497c6a3eca Initial revision
casties
parents:
diff changeset
417
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
418 logger('INFO', (scalar keys %$files_to_archive) . " files to archive");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
419
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
420 # remove .archived file
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
421 if (-f "$docdir/.archived") {
30497c6a3eca Initial revision
casties
parents:
diff changeset
422 if (unlink "$docdir/.archived") {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
423 logger('WARNING', "existing .archived file has been removed!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
424 $warncnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
425 } else {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
426 logger('ERROR', "unable to remove existing .archived file!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
427 $errcnt++;
30497c6a3eca Initial revision
casties
parents:
diff changeset
428 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
429 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
430
30497c6a3eca Initial revision
casties
parents:
diff changeset
431 # remove junk files
30497c6a3eca Initial revision
casties
parents:
diff changeset
432 if ($delete_junk_files) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
433 delete_all_files(\%MPIWGStor::junk_files, $docdir);
30497c6a3eca Initial revision
casties
parents:
diff changeset
434 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
435
30497c6a3eca Initial revision
casties
parents:
diff changeset
436 # write new index.meta
30497c6a3eca Initial revision
casties
parents:
diff changeset
437 if ($errcnt > 0) {
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
438 logger('ABORT', "there were errors!");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
439 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
440 } else {
30497c6a3eca Initial revision
casties
parents:
diff changeset
441 if ($fix_xml) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
442 MPIWGStor::write_xml($document, $metafile);
30497c6a3eca Initial revision
casties
parents:
diff changeset
443 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
444 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
445
30497c6a3eca Initial revision
casties
parents:
diff changeset
446 # start archiving
5
1a377102b1ce small fix for number of hash keys
casties
parents: 1
diff changeset
447 my $archived_files = run_archive();
1a377102b1ce small fix for number of hash keys
casties
parents: 1
diff changeset
448 my $num_archfiles = scalar keys %$archived_files;
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
449
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
450 logger('INFO', "$num_archfiles files archived");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
451
30497c6a3eca Initial revision
casties
parents:
diff changeset
452 # check list of archived files
30497c6a3eca Initial revision
casties
parents:
diff changeset
453 check_files($files_to_archive, $archived_files);
30497c6a3eca Initial revision
casties
parents:
diff changeset
454
30497c6a3eca Initial revision
casties
parents:
diff changeset
455 # delete files if all went OK
30497c6a3eca Initial revision
casties
parents:
diff changeset
456 if ($errcnt == 0) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
457 system("touch", "$docdir/.archived");
30497c6a3eca Initial revision
casties
parents:
diff changeset
458 # remove junk files (again)
30497c6a3eca Initial revision
casties
parents:
diff changeset
459 if ($delete_junk_files) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
460 delete_all_files(\%MPIWGStor::junk_files, $docdir);
30497c6a3eca Initial revision
casties
parents:
diff changeset
461 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
462 # remove archived files
30497c6a3eca Initial revision
casties
parents:
diff changeset
463 if ($delete_data_files) {
30497c6a3eca Initial revision
casties
parents:
diff changeset
464 delete_files($archived_files);
30497c6a3eca Initial revision
casties
parents:
diff changeset
465 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
466 }
30497c6a3eca Initial revision
casties
parents:
diff changeset
467
18
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
468 logger('INFO', "$warncnt warnings");
fdf4ceb36db1 fixed problem with dir names in metacheck
casties
parents: 11
diff changeset
469 logger('INFO', "$errcnt errors");
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
470 if ($errcnt > 0) {
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
471 logger('ABORT', "there were errors! ($num_archfiles files archived) at " . stime(time));
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
472 exit 1;
30497c6a3eca Initial revision
casties
parents:
diff changeset
473 } else {
11
b19df18aa19a updated command line option parsing and logging
casties
parents: 5
diff changeset
474 logger('DONE', "$num_archfiles files archived at " . stime(time));
0
30497c6a3eca Initial revision
casties
parents:
diff changeset
475 }