#!/bin/bash
# DEVELOPER: Vaibhav K

PARABLU_COMPONENT_SCRIPT_PATH=../config/parablu_component_config.sh
PARABLU_CONFIG_SCRIPT_PATH=../config/parablu_config.sh

source $PARABLU_COMPONENT_SCRIPT_PATH
source $PARABLU_CONFIG_SCRIPT_PATH

PG1_PATH="/var/lib/tomcat-pg1"
PCB1_PATH="/var/lib/tomcat-pcb1"

                service tomcat-pcb1 stop
                service tomcat-pg1 stop

                cp -r $PG1_PATH $PG1_PATH-backup

                cp -r $PCB1_PATH/webapps/*  $PG1_PATH/webapps/

		sed -i 's|tomcat-pcb1|tomcat-pg1|' health_check/common_health_check.sh

                chown -R tomcat:tomcat $PG1_PATH
		chmod -R 755 $PG1_PATH/webapps/*

                service tomcat-pg1 restart
