Changeset 21996 for gs3-extensions/mat

Show
Ignore:
Timestamp:
29.04.2010 16:34:05 (9 years ago)
Author:
sjm84
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash

    r18086 r21996  
     1#!/bin/bash 
    12# if this file is executed, /bin/sh is used, as we don't start with #! 
    23# this should work under ash, bash, zsh, ksh, sh style shells. 
    3  
    4  
    5  
    64# $1 should be the collection name 
    75# $2 should be the oai URL 
     
    1210# $7 should be the collection directory 
    1311# $8 should the log file 
     12# $9 should be the host name : port number 
    1413 
    1514#$GS3_ROOT=$6 
    1615#$COLLECT_DIR=$7 
    1716#$LOG_FILE=$8 
     17CACHE_DIR=$3 
    1818 
    1919# 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 
    2030 
    2131TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'` 
    2232echo Tomcat_ID: $TOMCAT_ID 
    2333 
    24 NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` 
    25 echo open files: $NUM_OPEN_FILES 
     34if [ ! -z "$lsof" ] ; then 
     35  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l ` 
     36  echo open files: $NUM_OPEN_FILES 
     37fi 
    2638 
    2739cd $6 
     
    3850echo "Away to build"  >> $8 
    3951 
    40 build -indextype lucene -site localsite -collectdir $7 -log_events -download file://$3  $1 2>&1 
     52build -indextype lucene -site localsite -collectdir $7 -log_events -download file://$CACHE_DIR  $1 2>&1 
    4153#2>&1  >> $LOG_FILE 
    4254 
    4355# -log_events 
    4456# >> $LOG_FILE 
    45 NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` 
    46 echo open files: $NUM_OPEN_FILES 
     57if [ ! -z "$lsof" ] ; then 
     58  NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l ` 
     59  echo open files: $NUM_OPEN_FILES 
     60fi 
    4761 
    4862echo "Build finished ...." >> $8 
     
    6074# >> $LOG_FILE 
    6175 
    62 convert_coll_from_gs2.pl -collectdir $7 $1  
    63  
    64 NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` 
    65 echo open files: $NUM_OPEN_FILES 
    66 # >> $LOG_FILE 
     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 
    6781 
    6882echo "Away to reconfigure Greenstone 3 server"  >> $8 
     
    7286 
    7387#wget -O /tmp/mat5.html "http://localhost:8090/greenstone3/library?a=s&sa=c"  
    74 wget -O /tmp/mat3.html "http://localhost:8090/greenstone3/library?a=s&sa=c"  
     88wget -O /tmp/mat3.html "http://$9/greenstone3/library?a=s&sa=c"  
    7589 
    7690echo "Done"  >> $8 
    7791echo "Done"  
    78 NUM_OPEN_FILES=`/usr/sbin/lsof -p $TOMCAT_ID | wc -l ` 
    79 echo open files: $NUM_OPEN_FILES 
    8092 
    81 /usr/sbin/lsof -p $TOMCAT_ID  
     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  
    8298# >> $LOG_FILE 
     99fi 
    83100 
    84101