1 | # if this file is executed, /bin/sh is used, as we don't start with #!
|
---|
2 | # this should work under ash, bash, zsh, ksh, sh style shells.
|
---|
3 | # $1 should be the collection name
|
---|
4 | # $2 should be the oai URL
|
---|
5 | # $3 should the cache directory
|
---|
6 | # $4 should be the max records
|
---|
7 | # $5 should be the OAI metadata prefix
|
---|
8 | # $6 should be GS3 root
|
---|
9 | # $7 should be the collection directory
|
---|
10 | # $8 should the log file
|
---|
11 | # $9 should be the creator
|
---|
12 | # $10 should be the proxy settings
|
---|
13 | GS3_ROOT=$6
|
---|
14 | COLLECT_DIR=$7
|
---|
15 | LOG_FILE=$8
|
---|
16 |
|
---|
17 |
|
---|
18 | TOMCAT_ID=`ps ux | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'`
|
---|
19 | echo Tomcat_ID: $TOMCAT_ID
|
---|
20 | #cd /usr/sbin
|
---|
21 | NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
|
---|
22 | echo open files: $NUM_OPEN_FILES
|
---|
23 |
|
---|
24 | rm -f $LOG_FILE
|
---|
25 | cd $GS3_ROOT
|
---|
26 |
|
---|
27 | source gs3-setup.sh > $LOG_FILE
|
---|
28 |
|
---|
29 | cd gs2build/
|
---|
30 | source setup.bash >> $LOG_FILE
|
---|
31 |
|
---|
32 | perl -S mkcol.pl -gs3mode -collectdir $COLLECT_DIR $1
|
---|
33 |
|
---|
34 | echo $1 $2 $3 $4 $5 $6 $7 $8 >> $LOG_FILE
|
---|
35 |
|
---|
36 | NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
|
---|
37 | echo open files: $NUM_OPEN_FILES
|
---|
38 |
|
---|
39 | if [ ! -e $3 ] # be sure the cache directory exists
|
---|
40 | then
|
---|
41 | mkdir $3
|
---|
42 | else
|
---|
43 | /bin/rm -rf $3/*
|
---|
44 | fi
|
---|
45 |
|
---|
46 | echo "Away to download OAI" >> $LOG_FILE
|
---|
47 |
|
---|
48 | NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
|
---|
49 | echo open files: $NUM_OPEN_FILES
|
---|
50 |
|
---|
51 | downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -metadata_prefix $5 $9 2>&1 >> $LOG_FILE
|
---|
52 |
|
---|
53 | NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
|
---|
54 | echo open files: $NUM_OPEN_FILES
|
---|
55 |
|
---|
56 |
|
---|