version 1.1, 2004/06/17 15:58:42
|
version 1.2, 2004/09/23 19:55:44
|
Line 3
|
Line 3
|
use strict; |
use strict; |
|
|
use XML::LibXML; |
use XML::LibXML; |
|
use FileHandle; |
|
|
# MPIWG libraries |
# MPIWG libraries |
use lib '/usr/local/mpiwg/archive'; |
use lib '/usr/local/mpiwg/archive'; |
Line 17 $|=1;
|
Line 18 $|=1;
|
# |
# |
|
|
# program version |
# program version |
my $version = "0.1 (24.9.2003)"; |
my $version = "0.2 (23.9.2004)"; |
|
|
# read command line parameters |
# read command line parameters |
my $args = parseargs; |
my $args = parseargs; |
Line 55 if (! open LOG, ">>$log_file") {
|
Line 56 if (! open LOG, ">>$log_file") {
|
logger("ABORT", "unable to write log file '$log_file'!!"); |
logger("ABORT", "unable to write log file '$log_file'!!"); |
exit 1; |
exit 1; |
} |
} |
|
LOG->autoflush(1); |
|
|
####################################################### |
####################################################### |
# check parameters that were passed to the program |
# check parameters that were passed to the program |
Line 77 if (! -f $metafile) {
|
Line 79 if (! -f $metafile) {
|
exit 1; |
exit 1; |
} |
} |
|
|
|
# construct document's parent dir |
|
my $docparent = $docdir; |
|
$docparent =~ s!/[^/]+$!!; |
|
|
####################################################### |
####################################################### |
# internal variables |
# internal variables |
Line 172 sub read_resource_meta {
|
Line 177 sub read_resource_meta {
|
# runs the retriever program on $docdir and returns a list of archived files |
# runs the retriever program on $docdir and returns a list of archived files |
# |
# |
# Sample output: |
# Sample output: |
# Retrieving 17,234 /mpiwg/archive/data/test/auto_titit_123/pageimg/essen-wind1.jpg [Done] |
# (old!) Retrieving 17,234 /mpiwg/archive/data/test/auto_titit_123/pageimg/essen-wind1.jpg [Done] |
# |
# Retrieving 42,406,326 /mpiwg/archive/data/library/B980G582/raw/00015.tif --> /mpiwg/archive/data/library/B980G582/raw/00015.tif [Done] |
sub run_retrieve { |
sub run_retrieve { |
my %files; |
my %files; |
print LOG "START unarchive $version ", scalar localtime, "\n"; |
print LOG "START unarchive $version on ", scalar localtime, "\n"; |
my $archcmd = $archprog; |
my $archcmd = $archprog; |
$archcmd .= " retrieve -subdir=yes -replace=all"; |
$archcmd .= " retrieve -subdir=yes -replace=all"; |
$archcmd .= " -description='$archname'"; |
$archcmd .= " -description='$archname'"; |
$archcmd .= " '$docdir/'"; |
$archcmd .= " '$docdir/'"; # archive name |
|
$archcmd .= " '$docparent/'"; # destination dir name |
|
|
my $archcnt = 0; |
my $archcnt = 0; |
print LOG "CMD: $archcmd\n"; |
print LOG "CMD: $archcmd\n"; |
Line 192 sub run_retrieve {
|
Line 198 sub run_retrieve {
|
Retrieving |
Retrieving |
\s+([\d,]+) # size |
\s+([\d,]+) # size |
\s+(\S+) # file name |
\s+(\S+) # file name |
|
\s+--> |
|
\s+(\S+) # destination file name |
\s+\[Done\] |
\s+\[Done\] |
/x) { |
/x) { |
my $size = $1; |
my $size = $1; |
Line 271 logger("INFO", "unarchiver $version");
|
Line 279 logger("INFO", "unarchiver $version");
|
|
|
# make shure the right user is running this program |
# make shure the right user is running this program |
my $user = getlogin; |
my $user = getlogin; |
if (($user ne "archive")&&($user ne "root")) { |
if (($user)&&($user ne "archive")&&($user ne "root")) { |
logger("ABORT", "you must be archive or root user to run this program!"); |
logger("ABORT", "you must be archive or root user to run this program!"); |
exit 1; |
exit 1; |
} |
} |