target_ips=(
'10.15.241.21'
'10.15.241.22'
'10.15.241.23'
'10.15.241.24'
'10.15.241.25'
);
function setupOneTarget()
{
index=$1;
current_ip=${target_ips[$index]};
echo try to setup current_ip: $current_ip;
echo step 1: copy files
scp -i /root/.ssh/cloud-multimedia.key libevent-2.0.21-stable.tar.gz root@$current_ip:/root/
scp -i /root/.ssh/cloud-multimedia.key turn.tar.gz root@$current_ip:/root/
scp -i /root/.ssh/cloud-multimedia.key turnserver.conf root@$current_ip:/etc/
echo step 2: unzip file
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root; tar xvf libevent-2.0.21-stable.tar.gz'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root; tar xvf turn.tar.gz'
echo step3: compile and install
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'yum -y install openssl-devel.x86_64'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root/libevent-2.0.21-stable/; ./configure --enable-openssl=yes; make -j8; make install'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root/turn/; ./configure; make -j8; make install'
echo setup current_ip: $current_ip done;
}
function setupTarget()
{
for((i = 0; i < $1; i++))
do setupOneTarget $i;
done;
}
'10.15.241.21'
'10.15.241.22'
'10.15.241.23'
'10.15.241.24'
'10.15.241.25'
);
function setupOneTarget()
{
index=$1;
current_ip=${target_ips[$index]};
echo try to setup current_ip: $current_ip;
echo step 1: copy files
scp -i /root/.ssh/cloud-multimedia.key libevent-2.0.21-stable.tar.gz root@$current_ip:/root/
scp -i /root/.ssh/cloud-multimedia.key turn.tar.gz root@$current_ip:/root/
scp -i /root/.ssh/cloud-multimedia.key turnserver.conf root@$current_ip:/etc/
echo step 2: unzip file
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root; tar xvf libevent-2.0.21-stable.tar.gz'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root; tar xvf turn.tar.gz'
echo step3: compile and install
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'yum -y install openssl-devel.x86_64'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root/libevent-2.0.21-stable/; ./configure --enable-openssl=yes; make -j8; make install'
ssh -i /root/.ssh/cloud-multimedia.key -p 22 root@$current_ip 'cd /root/turn/; ./configure; make -j8; make install'
echo setup current_ip: $current_ip done;
}
function setupTarget()
{
for((i = 0; i < $1; i++))
do setupOneTarget $i;
done;
}