source: other-projects/trunk/greenstone3-extension/mat/bin/script/mat-colbuild-download.bash@ 18087

Last change on this file since 18087 was 18087, checked in by cc108, 15 years ago

This file is used to download OAI from remote repository

  • Property svn:executable set to *
File size: 1.9 KB
Line 
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
4
5
6# $1 should be the collection name
7# $2 should be the oai URL
8# $3 should the cache directory
9# $4 should be the max records
10# $5 should be the OAI metadata prefix
11# $6 should be GS3 root
12# $7 should be the collection directory
13# $8 should the log file
14
15GS3_ROOT=$6
16COLLECT_DIR=$7
17LOG_FILE=$8
18
19
20TOMCAT_ID=`ps ux | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'`
21echo Tomcat_ID: $TOMCAT_ID
22#cd /usr/sbin
23NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
24echo open files: $NUM_OPEN_FILES
25
26rm -f $LOG_FILE
27cd $GS3_ROOT
28
29source gs3-setup.sh > $LOG_FILE
30
31cd gs2build/
32source setup.bash >> $LOG_FILE
33
34perl -S mkcol.pl -collectdir $COLLECT_DIR -creator $9 $1
35
36# need to ensure that OAIPLUG is included
37# hack the model collection to include it
38
39echo $1 $2 $3 $4 $5 $6 $7 $8 >> $LOG_FILE
40
41NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
42echo open files: $NUM_OPEN_FILES
43
44if [ ! -e $3 ] # be sure the cache directory exists
45then
46 mkdir $3
47else
48 /bin/rm -rf $3/*
49fi
50
51echo "Away to download OAI" >> $LOG_FILE
52
53NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
54echo open files: $NUM_OPEN_FILES
55
56# use this line when metadata prefix has been added to OAI downloader
57# downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -prefix $5 -proxy_on -proxy_host wwwcache.cs.waikato.ac.nz -proxy_port 80
58
59downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -metadata_prefix $5 -proxy_on -proxy_host wwwcache.cs.waikato.ac.nz -proxy_port 80 2>&1 >> $LOG_FILE
60
61#downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -metadata_prefix $5 >> $LOG_FILE
62
63NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l `
64echo open files: $NUM_OPEN_FILES
65# 2>&1 >> /tmp/mat.txt
66
67#source $GS3_ROOT/gs2build/bin/script/mat-colbuild.bash $1 $2 $3 $4 $5 $GS3_ROOT $COLLECT_DIR $LOG_FILE
68
Note: See TracBrowser for help on using the repository browser.