#!/bin/bash

LONG_DATE=`date +%Y%m%d%H%M%S`

/etc/init.d/tomcat8 stop
/etc/init.d/apache2 stop

TOMCAT_USER=tomcat8
TOMCAT_HOME=/var/lib/tomcat8
APACHE_CONF=/etc/apache2
#SOURCE_DIR=/usr/share/portal
#rm -rf ${SOURCE_DIR}

rm -rf ${TOMCAT_HOME}/webapps/portal
rm -f ${TOMCAT_HOME}/webapps/portal*
rm -f ${TOMCAT_HOME}/conf/Catalina/localhost/portal.xml
rm -f ${TOMCAT_HOME}/conf/policy.d/56portal.policy
rm -f ${APACHE_CONF}/jk_mount/portal_jk.*

rm -rf /etc/dataone/portal

/etc/init.d/tomcat8 start
/etc/init.d/apache2 start

## Update DateONE Version Info Doc
java -jar /usr/share/dataone-cn-version-tool/dataone-cn-version-tool.jar -F/usr/share/dataone-cn-version-tool/version-tool.properties -html > /var/www/cn-version.html

exit 0