Subversion Repositories SmartDukaan

Rev

Rev 3042 | Rev 3899 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2366 rajveer 1
#!/bin/bash
2
 
3
if [ $# -ne 1 ]
4
then
5
    echo "Error - Invalid Arguments. Please enter entity id of 7 digits"
6
    exit
7
fi
8
ENTITY_ID=$1
9
echo $ENTITY_ID
10
# resolve links - $0 may be a softlink
11
PRG="$0"
12
 
13
while [ -h "$PRG" ]; do
14
  ls=`ls -ld "$PRG"`
15
  link=`expr "$ls" : '.*-> \(.*\)$'`
16
  if expr "$link" : '/.*' > /dev/null; then
17
    PRG="$link"
18
  else
19
    PRG=`dirname "$PRG"`/"$link"
20
  fi
21
done
22
 
23
# Get standard environment variables
24
PRGDIR=`dirname $(readlink -f "$PRG")`
25
 
26
PROJECT_DIR="`dirname ${PRGDIR}`"
27
LOG_DIR="/var/log/content-generation"
28
DATE=`date +%Y-%b-%d-%Hh%Mm%Ss`
29
MYSQL_DUMP="${PRGDIR}/partial-catalog-${DATE}.sql"
30
CONTENT_LOG="${LOG_DIR}/content-generation-${DATE}.log"
31
SOLR_IRDATA=/var/lib/tomcat6/webapps/export/solr/
32
 
33
STAGING_SERVER="192.168.138.69"
34
STAGING_ENTITIES_EXPORT_PATH="entities-shop2020"
35
 
36
PROD_SERVER="192.168.141.43"
37
PROD_ENTITIES_EXPORT_PATH="entities-saholic"
38
 
39
 
40
ENTITIES_DEST_PATH="/var/lib/tomcat6/webapps/export/html/entities/"
41
 
42
MAVEN_REPO="${HOME}/.m2/repository"
3898 chandransh 43
M2_CLASSPATH="${MAVEN_REPO}/in/shop2020/ContentStore/1.0-SNAPSHOT/ContentStore-1.0-SNAPSHOT.jar:${MAVEN_REPO}/in/shop2020/ThriftConfig/1.0-SNAPSHOT/ThriftConfig-1.0-SNAPSHOT.jar:${MAVEN_REPO}/in/shop2020/Common/1.0-SNAPSHOT/Common-1.0-SNAPSHOT.jar:${MAVEN_REPO}/readonly/apache/velocity/1.6.3/velocity-1.6.3.jar:${MAVEN_REPO}/readonly/apache/commons-lang/2.4/commons-lang-2.4.jar:${MAVEN_REPO}/readonly/apache/commons-collections/3.2.1/commons-collections-3.2.1.jar:${MAVEN_REPO}/org/apache/thrift/libthrift/0.7.0/libthrift-0.7.0.jar:${MAVEN_REPO}/readonly/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar:${MAVEN_REPO}/readonly/slf4j/slf4j-simple/1.5.8/slf4j-simple-1.5.8.jar:${MAVEN_REPO}/readonly/apache/commons-logging-api/1.1/commons-logging-api-1.1.jar:${MAVEN_REPO}/readonly/bdb/je/4.1.7/je-4.1.7.jar:${MAVEN_REPO}/readonly/jython/2.5.1/jython-2.5.1.jar:${MAVEN_REPO}/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:${MAVEN_REPO}/readonly/apache/commons-io/1.3.2/commons-io-1.3.2.jar:${MAVEN_REPO}/org/json/json/20090211/json-20090211.jar:${MAVEN_REPO}/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar:${MAVEN_REPO}/com/google/code/gson/gson/1.6/gson-1.6.jar:${MAVEN_REPO}/javax/mail/mail/1.4/mail-1.4.jar"
2366 rajveer 44
 
45
 
46
echo "Generating content for one entities ${PROJECT_DIR}"
47
echo "======================================================="
48
cd ${PROJECT_DIR}/ContentStore
3042 rajveer 49
echo executing command java -cp ${M2_CLASSPATH}  in.shop2020.util.ContentGenerationUtility -u CATALOG -t ONE -e ${ENTITY_ID}
50
java -cp ${M2_CLASSPATH}  in.shop2020.util.ContentGenerationUtility -u CATALOG -t ONE -e ${ENTITY_ID} > ${CONTENT_LOG} 
2366 rajveer 51
echo "======================================================="
52
echo "Content generation completed"
53
 
54
echo "Copying generated content to production servers"
55
echo "======================================================="
56
#Update entities on staging using the entities-shop2020 direcotry
57
cd /var/lib/tomcat6/webapps/export/html
2377 rajveer 58
scp -r ${PROD_ENTITIES_EXPORT_PATH}/${ENTITY_ID} ${PROD_SERVER}:${ENTITIES_DEST_PATH}
2366 rajveer 59
 
60
#Update solr data on staging and production servers
61
scp ${SOLR_IRDATA}${ENTITY_ID}_irdata_solr.xml ${PROD_SERVER}:${SOLR_IRDATA}
62
 
63
echo "Done copying content to staging and production servers"
64
echo "======================================================="
65
 
66
echo "Posting data to solr on prod server"
67
echo "======================================================="
68
ssh ${PROD_SERVER} "cd /root/solr/example/exampledocs; java -jar post.jar ${PROD_SERVER}:${SOLR_IRDATA}${ENTITY_ID}_irdata_solr.xml"
69
echo "Posting data to solr on prod server"
70
echo "======================================================="