#!/bin/sh
# 
target_host=192.168.10.2
modules='di-ting du-jiang-yan han-gu-guan jian-men-guan mall pay-center quartz xyqb'

function copy_to()
{
	module=$1
	mkdir -p  /home/quant_group/${module}
	echo cd /home/quant_group/${module}
	cd  /home/quant_group/${module}
	rm -rf *

	tar zxf /home/quant_group/deploy_backup/${module}/${module}.${target_host}.tgz -C /home/quant_group/${module}/
	mv ${module}.${target_host}/* ./
	cp /home/quant_group/deploy_backup/${module}/*.jar ./
}

if [[ "${module_name}" = "ALL" ]]
then
	for module in $modules
	do
	    copy_to ${module}
        echo ${module}
	done
elif [[ "${module_name}" = "" ]]
then
   echo 'Fail module name is empty'
   exit -1
else
	copy_to ${module_name}
 	echo ${module_name}
fi