#!/bin/bash
source ./ipconfig
echo "start edit";
declare -i Dline;
cd tomcat/webapps/ROOT/WEB-INF
Dline=$(awk "BEGIN{a=`grep -n "serverName" web.xml | head -1 | cut -d ":" -f 1;`;b="2";c=(a+b);print c}");
echo "web.xml edit is ${Dline}";
sed -i "${Dline},${Dline}s/.*/\<param-value\>http:\/\/${IPURL}\<\/param-value\>/g" web.xml
cd run/config
Dline=$(awk "BEGIN{a=`grep -n "rt_server" config.properties | head -1 | cut -d ":" -f 1;`;b="1";c=(a+b);print a}");
echo "config.properties edit is ${Dline}";
sed -i "${Dline},${Dline}s/.*/server=http:\/\/${IPURL}\/rt\//g" config.properties