Strabon
changeset 419:28ce0ecfb65b
Add tomcat selection and checking remote ntriples files instead of local
author | George Garbis <ggarbis@di.uoa.gr> |
---|---|
date | Tue Jul 10 20:47:40 2012 +0300 (2012-07-10) |
parents | eebc02275912 |
children | dd0dce56577b |
files | scripts/v2.1/runNoaRefinementChain.sh |
line diff
1.1 --- a/scripts/v2.1/runNoaRefinementChain.sh Tue Jul 10 20:46:11 2012 +0300 1.2 +++ b/scripts/v2.1/runNoaRefinementChain.sh Tue Jul 10 20:47:40 2012 +0300 1.3 @@ -2,9 +2,13 @@ 1.4 LOC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 1.5 1.6 ENDPOINT="http://localhost:8080/endpoint" 1.7 -DB="v21" 1.8 +DB="endpoint" 1.9 GRIDURL="http://kk.di.uoa.gr/grid_4.nt" 1.10 + 1.11 CHECKDIR="/home/konstantina/allhot/" 1.12 +#CHECKDIR="${HOME}/teleios/nkua/Hotspots/" 1.13 + 1.14 +#POSTGISTEMPLATE="postgistemplate" 1.15 POSTGISTEMPLATE="template_postgis" 1.16 1.17 #dataDir="http://localhost/noa-teleios/out_triples/" 1.18 @@ -35,6 +39,22 @@ 1.19 fi 1.20 } 1.21 1.22 +function chooseTomcat() 1.23 +{ 1.24 + if test -s /etc/fedora-release ; then 1.25 + tomcat="tomcat" 1.26 + #elif test -s /etc/centos-release ; then 1.27 + #elif test -s /etc/yellowdog-release ; then 1.28 + #elif test -s /etc/redhat-release ; then 1.29 + #elif test -s /etc/SuSE-release ; then 1.30 + #elif test -s /etc/gentoo-release ; then 1.31 + elif test -s /etc/lsb-release ; then # Ubuntu 1.32 + tomcat="tomcat7" 1.33 + elif test -s /etc/debian_version ; then 1.34 + tomcat="tomcat" 1.35 + fi 1.36 +} 1.37 + 1.38 #prin 1.39 #tmr1=$(timer) 1.40 #meta 1.41 @@ -48,25 +68,25 @@ 1.42 refineTimePersistence=`cat ${LOC}/TimePersistence.sparql` # | sed 's/\"/\\\"/g'` 1.43 1.44 # Initialize 1.45 +chooseTomcat 1.46 sudo service postgresql restart 1.47 echo "Dropping endpoint database"; 1.48 sudo -u postgres dropdb ${DB} 1.49 echo "Creating endpoint database" 1.50 -sudo -u postgres createdb ${DB} -T ${POSTGISTEMPLATE} 1.51 +sudo -u postgres createdb ${DB} #-T ${POSTGISTEMPLATE} 1.52 echo "restarting tomcat" 1.53 -sudo service tomcat7 restart 1.54 +sudo service ${tomcat} restart 1.55 1.56 echo "initializing database" 1.57 echo "S D R TP" >>stderr.txt 1.58 1.59 # ../endpoint store ${ENDPOINT} N-Triples -u ${GRIDURL} 1.60 1.61 -sudo -u postgres bash -c "curl -s http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-dump.tgz|tar xz -O|psql -d ${DB}" 1.62 +sudo -u postgres sh -c "curl -s http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-dump.tgz|tar xz -O|psql -d ${DB}" 1.63 #./scripts/endpoint query ${ENDPOINT} "SELECT (COUNT(*) AS ?C) WHERE {?s ?p ?o}" 1.64 #sudo -u postgres psql -d endpoint -c 'CREATE INDEX datetime_values_idx_value ON datetime_values USING btree(value)'; 1.65 #sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;'; 1.66 1.67 - 1.68 #echo "Continue?" 1.69 #read a 1.70 1.71 @@ -77,33 +97,34 @@ 1.72 for m in `seq 0 15 45`; do 1.73 time=`printf "%02d%02d\n" $h $m` 1.74 time2=`printf "%02d:%02d\n" $h $m` 1.75 - day=`printf "%02d" $d` 1.76 + day=`printf "%02d" $d` 1.77 month=`printf "%02d" $mon` 1.78 file=${dataDir}${name}${month}${day}_${time}$suffix 1.79 # file=${dataUrl}${name}_${time}$suffix 1.80 - 1.81 - check=${CHECKDIR}${name}${month}${day}_${time}$suffix 1.82 1.83 - if [[ ! -e $check ]]; 1.84 + check=${CHECKDIR}${name}${month}${day}_${time}$suffix 1.85 + wget -q --spider $check 1.86 + 1.87 + if [[ ! $? -ne 0 ]]; 1.88 then echo "FILE" $check "NOT EXISTS" ; continue 1.89 fi 1.90 1.91 # store file 1.92 echo -n "storing " $file; echo; echo; 1.93 # echo "Hotspot : " $h:$m >> stderr.txt 1.94 -# ${countTime} ./strabon -db endpoint store $file 1.95 +# ${countTime} ./strabon -db endpoint store $file 1.96 1.97 tmr1=$(timer) 1.98 - ../endpoint store ${ENDPOINT} N-Triples -u ${file} 1.99 + ../endpoint store ${ENDPOINT} N-Triples -u ${file} 1.100 tmr2=$(timer) 1.101 printf '%s ' $((tmr2-tmr1)) >>stderr.txt 1.102 - 1.103 + 1.104 # sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;'; 1.105 1.106 echo;echo;echo;echo "File ${file} stored!" >> ${logFile} 1.107 # echo "Continue?" 1.108 # read a 1.109 - 1.110 + 1.111 # deleteSeaHotspots 1.112 echo -n "Going to deleteSeaHotspots 2007-${month}-${day}T${time2}:00 " ;echo; echo; echo; 1.113 query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/2007-${month}-${day}T${time2}:00/g" | \ 1.114 @@ -111,16 +132,16 @@ 1.115 sed "s/SENSOR/MSG2/g"` 1.116 # ${countTime} ./strabon -db endpoint update "${query}" 1.117 1.118 -tmr1=$(timer) 1.119 - ../endpoint update ${ENDPOINT} "${query}" 1.120 - 1.121 +tmr1=$(timer) 1.122 + ../endpoint update ${ENDPOINT} "${query}" 1.123 + 1.124 tmr2=$(timer) 1.125 printf '%s ' $((tmr2-tmr1)) >>stderr.txt 1.126 1.127 echo;echo;echo;echo "File ${file} deleteSeaHotspots done!" 1.128 # echo "Continue?" 1.129 # read a 1.130 - 1.131 + 1.132 # refinePartialSeaHotspots 1.133 echo -n "refinePartialSeaHotspots 2007-${month}-${day}T${time2}:00 " ; echo; echo ; echo; 1.134 query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/2007-${month}-${day}T${time2}:00/g" | \ 1.135 @@ -130,7 +151,6 @@ 1.136 # ${countTime} ./strabon -db endpoint update "${query}" 1.137 tmr1=$(timer) 1.138 ../endpoint update ${ENDPOINT} "${query}" 1.139 - 1.140 tmr2=$(timer) 1.141 printf '%s ' $((tmr2-tmr1)) >>stderr.txt 1.142 1.143 @@ -145,7 +165,7 @@ 1.144 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \ 1.145 sed "s/SENSOR/MSG2/g" | \ 1.146 sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \ 1.147 - sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g"` |\ 1.148 + sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g" |\ 1.149 sed "s/SAT/METEOSAT9/g"` 1.150 1.151 # echo "Query:" 1.152 @@ -162,7 +182,6 @@ 1.153 ../endpoint update ${ENDPOINT} "${query}" 1.154 tmr2=$(timer) 1.155 printf '%s \n' $((tmr2-tmr1)) >>stderr.txt 1.156 - 1.157 echo;echo;echo;echo "File ${file} timePersistence done!" 1.158 # echo "Continue?" 1.159 # read a 1.160 @@ -177,7 +196,7 @@ 1.161 1.162 # echo "Store $f" 1.163 # ${countTime} ./scripts/strabon -db endpoint store $f 1.164 -# 1.165 -# 1.166 +# 1.167 +# 1.168 #done 1.169