# 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 # $9 should be the creator # $10 should be the proxy settings 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 -gs3mode -collectdir $COLLECT_DIR $1 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 downloadfrom.pl -download_mode OAI -cache_dir $3 -url $2 -max_records $4 -metadata_prefix $5 $9 2>&1 >> $LOG_FILE NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES