a=(a b c d e f g h k m n x y z A B C D E F 0 I M N X Y Z R S L Q P 0 1 2 3 4 5 6 7 8 9 * & ^ % $ # @)
for ((i=0;i<10;i++));do
echo -n ${a[$RANDOM % ${#a[@]}]} >> passwd.txt
done
PA=`cat passwd.txt`
/bin/rm -rf passwd.txt
[ $# -ne 1 ] && echo "Please enter an instance name (For example: ./tomcatadd-03 test.wltest.com)" && exit 1
ITN=`echo $1`
#Add new instance information
ADD () {
if [ -d $JA/$ITN ];then
echo "Warning:There are already exists $JA/$ITN,Please check"
ANII
elif [ -d $TT/$ITN ];then
echo "Warning:There are already exists $TT/$ITN,Please check"
ANII
else
TBCI
fi
}
ANII () {
read -p "Enter the instance name you want to create:" ITN1
if [ -d $JA/$ITN1 ];then
echo "Warning:There are already exists $JA/$ITN1,Please check"
ANII
elif [ -d $TT/$ITN1 ];then
echo "Warning:There are already exists $TT/$ITN1,Please check"
ANII
else
echo "The instance name is $ITN1"
read -p "Is ok,please enter y or n:" READA
if [ $READA == y ];then
ITN=`echo $ITN1`
TBCI
else
ANII
fi
fi
}
#Modify the port number
sed -i s/8005/$NUM1/ $TT/$ITN/conf/server.xml
sed -i s/8080/$NUM2/ $TT/$ITN/conf/server.xml
sed -i s/8009/$NUM3/ $TT/$ITN/conf/server.xml
#Information confirmation
echo -e "\n"
echo "Make sure the information is correct"
echo -e "\n"
sed -n '22p' $TT/$ITN/conf/server.xml
sed -n '79p' $TT/$ITN/conf/server.xml
sed -n '105p' $TT/$ITN/conf/server.xml
sed -n '137,138p' $TT/$ITN/conf/server.xml
echo -e "\n"