#!/bin/bash
#                                                                                       #
# SCRIPT: bluvault_backup.sh                                                           #
# DATE:   05-May-2017                                                                   #
# REV:    1.0                                                                           #
# DEVELOPED BY: Parablu Systems                                                         #
# DEVELOPER: Vaibhav K
# PURPOSE: Contains all the utility functions for bluvault Installation                 #
# PLATFORM: Ubuntu                                                                      #


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 


		mkdir -p $BACKUP_PATH/Initial_backup/$BLUVAULT 
		mkdir -p $BACKUP_PATH/Initial_backup/$SUPPORT
		mkdir -p $BACKUP_PATH/Initial_backup/$PARAMAIL           
		mkdir -p $BACKUP_PATH/Initial_backup/PCB_REPO

		service tomcat-pcb1 stop
		
		mv $TOMCAT_PCB1_PATH/webapps/$BLUVAULT/*  $BACKUP_PATH/Initial_backup/$BLUVAULT
                mv $TOMCAT_PCB1_PATH/webapps/$SUPPORT/*  $BACKUP_PATH/Initial_backup/$SUPPORT
                mv $TOMCAT_PCB1_PATH/webapps/$PARAMAIL/* $BACKUP_PATH/Initial_backup/$PARAMAIL
		mv $TOMCAT_PCB1_PATH/$REPO_NAME/* $BACKUP_PATH/Initial_backup/PCB_REPO

		service tomcat-pcb1 start

               
		mkdir -p $BACKUP_PATH/Initial_backup/$BLUVAULT_JOB	
		mkdir -p $BACKUP_PATH/Initial_backup/JOB_REPO
		service tomcat-job1 stop

		mv $TOMCAT_JOB1_PATH/webapps/$BLUVAULT_JOB/*  $BACKUP_PATH/Initial_backup/$BLUVAULT_JOB
		mv $TOMCAT_JOB1_PATH/$REPO_NAME/*  $BACKUP_PATH/Initial_backup/JOB_REPO

		service tomcat-job1 start
