Subversion Repositories SmartDukaan

Rev

Rev 1989 | Rev 2859 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/bash

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

# Get standard environment variables
PRGDIR=`dirname $(readlink -f "$PRG")`

LOGDIR=${PRGDIR}
TOMCAT_HOME="/var/lib/tomcat6"
PROJECT_DIR="`dirname ${PRGDIR}`"
COMMON_DIR="${PROJECT_DIR}/Common"
MAVEN_REPO="${HOME}/.m2/repository"

DATE=`date +%Y-%b-%d_%Hh%Mm`
LOGERR=error-${DATE}.log

touch ${LOGERR}
exec 7>&2           # Link file descriptor #7 with stderr.
                    # Saves stderr.
exec 2> ${LOGERR}     # stderr replaced with file ${LOGERR}.

echo "Starting python services"
echo "======================================================================="
#start services
export PYTHONPATH=$PROJECT_DIR/PyProj/src:/usr/lib/pymodules/python2.6:/usr/lib/pymodules/python2.6/gtk-2.0:/usr/lib/python2.6:/usr/lib/python2.6/dist-packages:/usr/lib/python2.6/dist-packages/PIL:/usr/lib/python2.6/dist-packages/gst-0.10:/usr/lib/python2.6/dist-packages/gtk-2.0:/usr/lib/python2.6/lib-dynload:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/plat-linux2:/usr/local/lib/python2.6/dist-packages:/usr/local/lib/python2.6/dist-packages/Elixir-0.7.1-py2.6.egg

killall -9 python2.6
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/config/ConfigServer.py -f $COMMON_DIR/src/main/resources/shop2020.cfg >> ${LOGDIR}/config.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/model/v1/catalog/CatalogServer.py >> ${LOGDIR}/catalog.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/model/v1/user/UserContextServer.py >> ${LOGDIR}/user.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/model/v1/order/TransactionServer.py >> ${LOGDIR}/order.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/logistics/service/LogisticsServer.py >> ${LOGDIR}/logistics.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/helpers/impl/HelperServer.py >>  ${LOGDIR}/helpers.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/payments/PaymentsServer.py >> ${LOGDIR}/payments.log 2>&1 &
/usr/bin/python2.6 -u $PROJECT_DIR/PyProj/src/shop2020/model/v1/user/PromotionServer.py >> ${LOGDIR}/promotion.log 2>&1 &
/usr/bin/python2.6 -u /root/trunk-chkout/trunk/PyProj/src/shop2020/helpers/impl/EmailSender.py >>  ${LOGDIR}/emailsender.log 2>&1 &

echo "Started python services"
echo "======================================================================="

echo "Starting Tomcat"
echo "======================================================================="
# deploy war and start tomcat
/etc/init.d/tomcat6 stop
rm -rf ${TOMCAT_HOME}/webapps/ROOT* ${TOMCAT_HOME}/webapps/Support* ${TOMCAT_HOME}/webapps/Social*
cp ${MAVEN_REPO}/in/shop2020/Website/1.0-SNAPSHOT/Website-1.0-SNAPSHOT.war ${TOMCAT_HOME}/webapps/ROOT.war
cp ${MAVEN_REPO}/in/shop2020/Support/1.0-SNAPSHOT/Support-1.0-SNAPSHOT.war ${TOMCAT_HOME}/webapps/Support.war
cp ${MAVEN_REPO}/in/shop2020/Social/1.0-SNAPSHOT/Social-1.0-SNAPSHOT.war ${TOMCAT_HOME}/webapps/Social.war
/etc/init.d/tomcat6 start
sleep 5
echo "Started tomcat"
echo "======================================================================="

#Clean up IO redirection
exec 2>&7 7>&-      # Restore stdout and close file descriptor #7.