Commit e5f4df21 authored by tywldx's avatar tywldx

把IP获取的方式提出去

parent f5b8764f
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
source ~/.bash_profile source ~/.bash_profile
source ~/.profile source ~/.profile
pwd_path="/home/qa-deploy-utils"
if [ $# -ne 10 ]; then if [ $# -ne 10 ]; then
echo "---------------" echo "---------------"
...@@ -53,24 +54,7 @@ do ...@@ -53,24 +54,7 @@ do
echo >&1000 echo >&1000
done done
function valid_ip() target_db_host=`sh $pwd_path/get-ip.sh $ip_value`
{
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
return $stat
}
if valid_ip $ip_value; then target_db_host="$ip_value"; else target_db_host="192.168.4.$ip_value"; fi
function db_schema_sync() function db_schema_sync()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment