# 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 # check we are still in the right directories TOMCAT_ID=`ps ux | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'` echo Tomcat_ID: $TOMCAT_ID NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES cd $6 source gs3-setup.sh >> $8 cd gs2build/ source setup.bash >> $8 # event log goes to greenstone3/gs2build/etc/events.txt ## build -indextype lucene -site localsite -collectdir $COLLECT_DIR -download file://$3 -log_events $1 echo "Away to build" >> $8 build -indextype lucene -site localsite -collectdir $7 -log_events -download file://$3 $1 2>&1 #2>&1 >> $LOG_FILE # -log_events # >> $LOG_FILE NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES echo "Build finished ...." >> $8 if [ -d $6/gs2build/collect/$1 ] then echo "moving from gs2 dir" >> $8 echo built in gs2 dir ... moving mv $6/gs2build/collect/$1 $7/$1 fi echo "Away to convert from Greenstone 2 to Greenstone 3" >> $8 echo "Away to convert from Greenstone 2 to Greenstone 3" # >> $LOG_FILE convert_coll_from_gs2.pl -collectdir $7 $1 NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES # >> $LOG_FILE echo "Away to reconfigure Greenstone 3 server" >> $8 echo "Away to reconfigure Greenstone 3 server" # >> $LOG_FILE #wget -O /tmp/mat5.html "http://localhost:8090/greenstone3/library?a=s&sa=c" wget -O /tmp/mat3.html "http://localhost:8090/greenstone3/library?a=s&sa=c" echo "Done" >> $8 echo "Done" NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` echo open files: $NUM_OPEN_FILES /usr/sbin/lsof -p $TOMCAT_ID # >> $LOG_FILE #exit 0