Strabon

changeset 864:1c1b26b37c41

Fix runChain.sh to run by default in teleios3
author George Garbis <ggarbis@di.uoa.gr>
date Wed Jan 23 12:50:26 2013 +0200 (2013-01-23)
parents 6889ed6b7ca2
children 152031be6487
files examples/teleios/runChain.sh
line diff
     1.1 --- a/examples/teleios/runChain.sh	Wed Jan 23 12:47:29 2013 +0200
     1.2 +++ b/examples/teleios/runChain.sh	Wed Jan 23 12:50:26 2013 +0200
     1.3 @@ -14,6 +14,8 @@
     1.4  # Author: Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
     1.5  #
     1.6  
     1.7 +# If tomcat is standalone then environment variable TOMCATPATH should be set
     1.8 +
     1.9  # Example run command: examples/teleios/runChain.sh -b http://dev.strabon.di.uoa.gr/rdf/data-dump-postgres-9.tgz  -l /home/ggarbis/runChain.log -e http://pathway.di.uoa.gr:8080/endpoint
    1.10  
    1.11  # Command name
    1.12 @@ -118,7 +120,7 @@
    1.13  				exit -1
    1.14  			fi
    1.15  			echo "Storing dump file ${options} in database ${db}..."
    1.16 -			psql ${db} -f ${options}
    1.17 +			psql -U postgres ${db} -f ${options}
    1.18  			;;
    1.19  	esac
    1.20  }
    1.21 @@ -127,8 +129,22 @@
    1.22  # -$1: Command for the service
    1.23  function handleTomcatService()
    1.24  {
    1.25 +	if test ! -z "${TOMCATPATH}" ; then
    1.26 +		case "${1}" in
    1.27 +			start)
    1.28 +				${TOMCATPATH}/bin/startup.sh
    1.29 +				;;
    1.30 +			stop)
    1.31 +				${TOMCATPATH}/bin/shutdown.sh
    1.32 +				;;
    1.33 +			restart)
    1.34 +				${TOMCATPATH}/bin/startup.sh
    1.35 +				${TOMCATPATH}/bin/shutdown.sh
    1.36 +				;;	
    1.37 +		esac	
    1.38 +		return
    1.39  	# find out the tomcat service to use
    1.40 -	if test -s /etc/fedora-release ; then
    1.41 +	elif test -s /etc/fedora-release ; then
    1.42  		tomcat="tomcat"
    1.43  	#elif test -s /etc/centos-release ; then
    1.44  	#elif test -s /etc/yellowdog-release ; then
    1.45 @@ -151,6 +167,7 @@
    1.46  	sudo service ${tomcat} $1
    1.47  }
    1.48  
    1.49 +
    1.50  # get the main version of postgres
    1.51  function getPostgresMainVersion() {
    1.52  	echo $(sudo service ${postgres} status | grep -o '.\..' | cut -b 1)
    1.53 @@ -194,6 +211,8 @@
    1.54  			url=${options}
    1.55  
    1.56  			tmr1=$(timer)
    1.57 +			#${endpointScript} store ${endpoint} N-Triples -u ${url}
    1.58 +			#read t
    1.59  			${endpointScript} store ${endpoint} N-Triples -u ${url}
    1.60  			tmr2=$(timer)
    1.61  
    1.62 @@ -210,6 +229,8 @@
    1.63  		query)
    1.64  			query=${options}
    1.65  			tmr1=$(timer)
    1.66 +			#${endpointScript} query ${endpoint} "${query}"
    1.67 +			#read t
    1.68  			${endpointScript} query ${endpoint} "${query}"
    1.69  			tmr2=$(timer)
    1.70  			printf '%s ' $((tmr2-tmr1)) >> ${logFile} 
    1.71 @@ -217,6 +238,8 @@
    1.72  		update)
    1.73  			update=${options}
    1.74  			tmr1=$(timer)
    1.75 +			#${endpointScript} update ${endpoint} "${update}"
    1.76 +			#read t
    1.77  			${endpointScript} update ${endpoint} "${update}"
    1.78  			tmr2=$(timer)
    1.79  			printf '%s ' $((tmr2-tmr1)) >> ${logFile}
    1.80 @@ -229,12 +252,12 @@
    1.81  }
    1.82  
    1.83  # default values
    1.84 -endpoint="http://pathway.di.uoa.gr:8080/endpoint"
    1.85 +endpoint="http://teleios3.di.uoa.gr:8080/endpoint"
    1.86  db="NOA2012"
    1.87  hotspotsURL="http://jose.di.uoa.gr/rdf/hotspots/MSG1"
    1.88  #                                 ./examples/teleios/data/data-dump-9.sql
    1.89 -bgFile="http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-ExcludeArea-dump.tgz"
    1.90 -logFile="runChain.log"
    1.91 +bgFile="http://dev.strabon.di.uoa.gr/rdf/data-dump-9.sql"
    1.92 +logFile="/home/ggarbis/runChain.log"
    1.93  
    1.94  chain="DynamicThresholds"
    1.95  persistence=10
    1.96 @@ -301,9 +324,12 @@
    1.97  echo "background: ${bgFile}"
    1.98  echo "logFile: ${logFile}"
    1.99  
   1.100 +echo > ${logFile}
   1.101 +echo 2222
   1.102  instantiate=${loc}/instantiate.sh
   1.103  
   1.104  #Initialize (stop tomcat, restart postgres, drop/create database, start tomcat)
   1.105 +echo 111
   1.106  handleTomcatService stop
   1.107  handlePostgresService restart
   1.108  
   1.109 @@ -313,10 +339,13 @@
   1.110  storeBackgroundData ${db} ${bgFile} # ~/Temp/Kallikratis-Coastline-Corine-postgres-9.sql
   1.111  
   1.112  handleTomcatService start
   1.113 +# Wait until tomcat server is up
   1.114 +until [ "`curl --silent --show-error --connect-timeout 1 -I ${endpoint} | grep 'Coyote'`" != "" ]; do sleep 1; done;
   1.115 +
   1.116  
   1.117  #${loc}/../../scripts/endpoint query ${endpoint} size 
   1.118  #exit -1
   1.119 -echo "Timestamp Store Municipalities DeleteInSea InvalidForFires DeleteReflections RefineInCoast TimePersistence DiscoverHotspots DiscoverFires" > ${logFile}
   1.120 +echo "Timestamp Store Municipalities DeleteInSea InvalidForFires RefineInCoast TimePersistence DiscoverHotspots" > ${logFile}
   1.121  echo > /home/ggarbis/discoverFires.log
   1.122  echo > /home/ggarbis/discover.log
   1.123  
   1.124 @@ -369,11 +398,11 @@
   1.125  #       echo "Invalid For Fires: ${update}" ; read t
   1.126  		handleStrabonEndpoint ${endpoint} update "${update}"
   1.127   
   1.128 -        # Delete Reflections
   1.129 -    	minTime=`date --date="${year}-${month}-${day} ${time2}:00 EEST -60 minutes" +%Y-%m-%dT%H:%M:00`
   1.130 -		update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} -m ${minTime} ${loc}/deleteReflections.rq`"
   1.131 -#        echo "Delete Reflections: ${update}" ;
   1.132 -		handleStrabonEndpoint ${endpoint} update "${update}"
   1.133 +#        # Delete Reflections
   1.134 +#    	minTime=`date --date="${year}-${month}-${day} ${time2}:00 EEST -60 minutes" +%Y-%m-%dT%H:%M:00`
   1.135 +#		update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} -m ${minTime} ${loc}/deleteReflections.rq`"
   1.136 +##        echo "Delete Reflections: ${update}" ;
   1.137 +#		handleStrabonEndpoint ${endpoint} update "${update}"
   1.138  
   1.139  		# Refine Partial Sea Hotspots
   1.140  		update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} ${loc}/refinePartialSeaHotspots.rq`"
   1.141 @@ -386,7 +415,7 @@
   1.142  #       echo "Refine Time Persistence: ${update}" ; read t
   1.143  		handleStrabonEndpoint ${endpoint} update "${update}" #2>&1 | tee /home/ggarbis/timePersistence.log
   1.144  
   1.145 -		#sudo -u postgres psql -d ${DB} -c 'VACUUM ANALYZE;';
   1.146 +		#psql -U postgres -d ${DB} -c 'VACUUM ANALYZE;';
   1.147          
   1.148  		# Discover
   1.149  		minTime=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00`
   1.150 @@ -394,14 +423,15 @@
   1.151          query="`${instantiate} -c ${chain} -s ${sensor} -m ${minTime} -M ${maxTime} ${loc}/discover.rq`"
   1.152  #        echo "Discover: ${query}" ; #read t
   1.153  		handleStrabonEndpoint ${endpoint} query "${query}" &>> /home/ggarbis/discover.log
   1.154 -    
   1.155 -		# Discover Fires
   1.156 -		minTime=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00`
   1.157 -		maxTime=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%M:00`
   1.158 -        query="`${instantiate} -c ${chain} -s ${sensor} -m ${minTime} -M ${maxTime} -p 10 -r 3 ${loc}/discoverFires.rq`"
   1.159 -#        echo "Discover Fires: ${query}" ; #read t
   1.160 -		handleStrabonEndpoint ${endpoint} query "${query}" &>> /home/ggarbis/discoverFires.log
   1.161 +#    
   1.162 +#		# Discover Fires
   1.163 +#		minTime=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00`
   1.164 +#		maxTime=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%M:00`
   1.165 +#        query="`${instantiate} -c ${chain} -s ${sensor} -m ${minTime} -M ${maxTime} -p 10 -r 3 ${loc}/discoverFires.rq`"
   1.166 +##        echo "Discover Fires: ${query}" ; #read t
   1.167 +#		handleStrabonEndpoint ${endpoint} query "${query}" &>> /home/ggarbis/discoverFires.log
   1.168  
   1.169 +		# Add a new line
   1.170          echo >> ${logFile}    
   1.171  	done
   1.172  done