#!/bin/sh
#created by hewd 2002-11-26

ParamDir=`pwd`

dstDataDir=/usr/local/mysql/data
srcDataDir=./data

echo "=======Import bss's cfg files======"
if [ -d "./cfgBak" ] ; then
	cp -rf ./cfgBak /home/build/iw05_01.050/compile/
	chown -R build:omc /home/build
else
	echo "No find ./cfgBak"
	exit 1
fi

####################################################
#echo "=======Importing bss's cfg files======"
#for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
#	bssId="bss-"$i
#	ip4="`expr 100 + $i`"
#	bssIp=172.18.128.$ip4
#	isConnect=`ping -c 1 $bssIp 2>>/dev/null |grep -c time`
#	if [ $isConnect -gt 0 ] ; then
#		cd /home/build/${BssVersion}/compile
#		cd cfgBak/${bssId}/cfg
#		../../hdput $bssIp $BssVersion/compile/cfg
#		echo "========Import $bssId's cfg file finished======="
#	else
#		echo "$bssId cannot connect"
#	fi
#done
######################################################

omcd stop
mysqld stop

echo "=======Import OMC's conf files======"
if [ -d "./conf" ] ; then
	mv -f /usr/local/omc/bin/conf/ /usr/local/omc/bin/conf_old
	cp -rf ./conf /usr/local/omc/bin/
else
	echo "No find ./conf"
	exit 1
fi

echo "=======Import OMC's database files======"

if [ -d "$srcDataDir" ] ; then
	needCopyDirList="AUC_DB BssOmcDb CDR_DB CSTA_DB EIR_DB HLR_DB \
				OBJ_* OMC_PUB OMC_WORK PPS_DB SN_DB VLR_DB VMS_DB mysql"
	for tmpDir in $needCopyDirList ; do
		cp -rf $srcDataDir/$tmpDir $dstDataDir
		echo " $srcDataDir/$tmpDir -> $dstDataDir/$tmpDir"
	done 

	chown -R mysql:mysql $dstDataDir
else
	echo "No find $srcDataDir"
	exit 1
fi

echo "Import parameter Finished"

mysqld start
omcd start
exit
