source: gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash@ 22041

Last change on this file since 22041 was 22041, checked in by sjm84, 14 years ago

Updated mat-colbuild.bash and mat-colbuild-download.bash so that they use more recent methods to create/build collections

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
2# if this file is executed, /bin/sh is used, as we don't start with #!
3# this should work under ash, bash, zsh, ksh, sh style shells.
4# $1 should be the collection name
5# $2 should be the oai URL
6# $3 should the cache directory
7# $4 should be GS3 root
8# $5 should be the collection directory
9# $6 should the log file
10# $7 should be the host name : port number
11
12COL_NAME=$1
13OAI_URL=$2
14CACHE_DIR=$3
15GS3_ROOT=$4
16COL_DIR=$5
17LOG_FILE=$6
18HOST_PORT=$7
19
20# check we are still in the right directories
21
22if [ -x /usr/bin/lsof ] ; then
23 lsof=/usr/bin/lsof
24else
25 if [ -x /usr/sbin/lsof ] ; then
26 lsof=/usr/sbin/lsof
27 else
28 echo "Warning: Unable to find 'lsof', skipping test for number of files open"
29 fi
30fi
31
32TOMCAT_ID=`ps ux | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $OAI_URL }'`
33echo Tomcat_ID: $TOMCAT_ID
34
35if [ ! -z "$lsof" ] ; then
36 NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
37 echo open files: $NUM_OPEN_FILES
38fi
39
40cd $GS3_ROOT
41source gs3-setup.sh >> $LOG_FILE
42
43cd gs2build/
44source setup.bash >> $LOG_FILE
45
46# event log goes to greenstone3/gs2build/etc/events.txt
47
48## build -indextype lucene -site localsite -collectdir $COLLECT_DIR -download file://$3 -log_events $1
49
50echo "Away to build" >> $LOG_FILE
51#echo "BABAB CACHE_DIR = Q $CACHE_DIR Q - COL_DIR = Q $COL_DIR Q - COL_NAME = Q $COL_NAME Q"
52#echo "AAAAA /bin/cp -r" $CACHE_DIR/* "$COL_DIR/$COL_NAME/import/."
53/bin/cp -r $CACHE_DIR/* $COL_DIR/$COL_NAME/import/.
54
55echo "perl -S incremental-rebuild.pl -site localsite -collectdir $COL_DIR $COL_NAME"
56
57perl -S incremental-rebuild.pl -site localsite -collectdir $COL_DIR $COL_NAME
58
59#build -indextype lucene -site localsite -collectdir $COL_DIR -log_events -download file://$CACHE_DIR $COL_NAME 2>&1
60#2>&1 >> $LOG_FILE
61
62# -log_events
63# >> $LOG_FILE
64if [ ! -z "$lsof" ] ; then
65 NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
66 echo Finished Build: open files: $NUM_OPEN_FILES
67fi
68
69echo "Build finished ...." >> $LOG_FILE
70
71if [ -d $GS3_ROOT/gs2build/collect/$COL_NAME ]
72then
73 echo "moving from gs2 dir" >> $LOG_FILE
74 echo built in gs2 dir ... moving
75 mv $GS3_ROOT/gs2build/collect/$COL_NAME $COL_DIR/$COL_NAME
76fi
77
78
79if [ ! -z "$lsof" ] ; then
80 NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
81 echo open files: $NUM_OPEN_FILES
82 # >> $LOG_FILE
83fi
84
85echo "Away to reconfigure Greenstone 3 server" >> $LOG_FILE
86echo "Away to reconfigure Greenstone 3 server"
87
88# >> $LOG_FILE
89
90#wget -O /tmp/mat5.html "http://localhost:8090/greenstone3/library?a=s&sa=c"
91wget -O /tmp/mat3.html "http://$HOST_PORT/greenstone3/library?a=s&sa=c"
92
93echo "Done" >> $LOG_FILE
94echo "Done"
95
96if [ ! -z "$lsof" ] ; then
97 NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
98 echo open files: $NUM_OPEN_FILES
99
100 $lsof -p $TOMCAT_ID
101# >> $LOG_FILE
102fi
103
104
105#exit 0
Note: See TracBrowser for help on using the repository browser.