#!/bin/bash
local_ip=`ifconfig|awk -F '[ :]+' 'NR==2 {print $4}'`
cd /usr/local/src/
wget http://192.168.5.222/activemq-cluster01.tar.gz
tar zxvf activemq-cluster01.tar.gz -C /opt
cd /opt/activemq-cluster01/conf
sed -i 's/10.46.28.217/'$local_ip'/g' activemq.xml
cp -rp /opt/activemq-cluster01 /opt/activemq-cluster02
cd /opt/activemq-cluster02/conf
sed -i 's/61616/61617/g' activemq.xml
sed -i 's/replicas="1"/replicas="2"/g' activemq.xml
sed -i 's/8161/8162/g' jetty.xml
sh /opt/activemq-cluster01/bin/activemq start
sh /opt/activemq-cluster02/bin/activemq start