root/gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash @ 21996

Revision 21996, 2.4 KB (checked in by sjm84, 10 years ago)

This now receives the hostname and port number from the servlet, also lsof is checked for in both /usr/bin and /usr/sbin, it also no longer attempts to convert collections from gs2 to gs3

  • Property svn:executable set to *
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 the max records
8# $5 should be the OAI metadata prefix
9# $6 should be GS3 root
10# $7 should be the collection directory
11# $8 should the log file
12# $9 should be the host name : port number
13
14#$GS3_ROOT=$6
15#$COLLECT_DIR=$7
16#$LOG_FILE=$8
17CACHE_DIR=$3
18
19# check we are still in the right directories
20
21if [ -x /usr/bin/lsof ] ; then
22  lsof=/usr/bin/lsof
23else
24  if [ -x /usr/sbin/lsof ] ; then
25    lsof=/usr/sbin/lsof
26  else
27    echo "Warning: Unable to find 'lsof', skipping test for number of files open"
28  fi
29fi
30
31TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'`
32echo Tomcat_ID: $TOMCAT_ID
33
34if [ ! -z "$lsof" ] ; then
35  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
36  echo open files: $NUM_OPEN_FILES
37fi
38
39cd $6
40source gs3-setup.sh >> $8
41
42cd gs2build/
43source setup.bash >> $8
44
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"  >> $8
51
52build -indextype lucene -site localsite -collectdir $7 -log_events -download file://$CACHE_DIR  $1 2>&1
53#2>&1  >> $LOG_FILE
54
55# -log_events
56# >> $LOG_FILE
57if [ ! -z "$lsof" ] ; then
58  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
59  echo open files: $NUM_OPEN_FILES
60fi
61
62echo "Build finished ...." >> $8
63
64if [ -d $6/gs2build/collect/$1 ]
65then
66    echo "moving from gs2 dir" >> $8
67    echo built in gs2 dir ... moving
68    mv $6/gs2build/collect/$1 $7/$1
69fi
70
71echo "Away to convert from Greenstone 2 to Greenstone 3"  >> $8
72echo "Away to convert from Greenstone 2 to Greenstone 3"
73
74# >> $LOG_FILE
75
76if [ ! -z "$lsof" ] ; then
77  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
78  echo open files: $NUM_OPEN_FILES
79  # >> $LOG_FILE
80fi
81
82echo "Away to reconfigure Greenstone 3 server"  >> $8
83echo "Away to reconfigure Greenstone 3 server"
84
85# >> $LOG_FILE
86
87#wget -O /tmp/mat5.html "http://localhost:8090/greenstone3/library?a=s&sa=c"
88wget -O /tmp/mat3.html "http://$9/greenstone3/library?a=s&sa=c"
89
90echo "Done"  >> $8
91echo "Done"
92
93if [ ! -z "$lsof" ] ; then
94  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
95  echo open files: $NUM_OPEN_FILES
96
97  $lsof -p $TOMCAT_ID
98# >> $LOG_FILE
99fi
100
101
102#exit 0
Note: See TracBrowser for help on using the browser.