#!/bin/bash Home=/home/simon GitLocalRoot=${Home}/local.git EmsBEDir=${GitLocalRoot}/be.ems EMSBuildDir=${GitLocalRoot}/build.ems user="root" password="1000omc@kp!" host="192.168.2.219" port="33066" dbname="omc_db" dumpdbdir=${EmsBEDir}/tools/misc insdir=${EMSBuildDir}/build/usr/local/omc/etc/db/install upgdir=${EMSBuildDir}/build/usr/local/omc/etc/db/upgrade upgvue3dir=${EMSBuildDir}/build/usr/local/omc/etc/db/upgvue3 tables_s=tables_s.lst tables_c=tables_c.lst tables_ic=tables_ic.lst mysql -h ${host} -P ${port} -u ${user} -p${password} -D ${dbname} -e "show tables ; " > tables.lst # dump table struct to install dir echo -n "dump table struct to install directory ... " while read line do table=`echo $line | cut -d " " -f 1` #echo "dump ${table} to install directory" mysqldump -h ${host} -P ${port} -u ${user} -p${password} -d ${dbname} ${table} > ${insdir}/${table}.sql done < ${dumpdbdir}/${tables_s} echo "done" # dump table struct and data to install dir echo -n "dump table struct and data to install directory ... " while read line do table=`echo $line | cut -d " " -f 1` #echo "dump ${table} to install directory" mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${insdir}/${table}.sql done < ${dumpdbdir}/${tables_ic} echo "done" # dump table struct and data to upgrade, upgvue3 and install dir echo -n "dump table struct and data to upgrade, upgvue3 and install directory ... " while read line do table=`echo $line | cut -d " " -f 1` #echo "dump ${table} to install & upgrade & upgvue3 directory" mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${insdir}/${table}.sql mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${upgdir}/${table}.sql mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${upgvue3dir}/${table}.sql done < ${dumpdbdir}/${tables_c} echo "done"