# if this file is executed, /bin/sh is used, as we don't start with #! # this should work under ash, bash, zsh, ksh, sh style shells. # $1 should be the collection name # $2 should be the oai URL # $3 should the cache directory # $4 should be the max records # $5 should be the OAI metadata prefix # $6 should be GS3 root # $7 should be the collection directory # $8 should the log file GS3_ROOT=$6 COLLECT_DIR=$7 LOG_FILE=$8 TOMCAT_ID=`ps ux | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'` echo Tomcat_ID: $TOMCAT_ID #cd /usr/sbin NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES rm -f $LOG_FILE cd $GS3_ROOT source gs3-setup.sh > $LOG_FILE cd gs2build/ source setup.bash >> $LOG_FILE perl -S mkcol.pl -collectdir $COLLECT_DIR -creator $9 $1 # need to ensure that OAIPLUG is included # hack the model collection to include it echo $1 $2 $3 $4 $5 $6 $7 $8 >> $LOG_FILE NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES if [ ! -e $3 ] # be sure the cache directory exists then mkdir $3 else /bin/rm -rf $3/* fi echo "Away to download OAI" >> $LOG_FILE NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES # use this line when metadata prefix has been added to OAI downloader # 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 downloadfrom.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 #downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -metadata_prefix $5 >> $LOG_FILE NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES # 2>&1 >> /tmp/mat.txt #source $GS3_ROOT/gs2build/bin/script/mat-colbuild.bash $1 $2 $3 $4 $5 $GS3_ROOT $COLLECT_DIR $LOG_FILE