第一次执行的脚本
auto-release-1-jar.sh
#!/bin/bash
svcname=$(ls -l /home/release-service/release_jar/|tr -s ' '|cut -d ' ' -f 9|cut -d '-' -f 3)
if (( $? == 0 ))
then
for i in $svcname
do
echo -e "\033[0;32m start exec servers-$i \033[0m"
svcip=$(cat /home/release-service/script/service-ip1-info.txt|grep "$i"|tr -s ' '|cut -d ' ' -f 2|tr '\n' ' ')
for j in $svcip
do
echo -e "\033[0;32m start exec $j ... \033[0m"
ssh -p 22 root@$j "cd /home/$i/ && rm -rf *.jar"
scp -P 22 -r /home/release-service/release_jar/firefighting-service-$i-*.jar $j:/home/$i/
if (( $? == 0 ))
then
echo -e "\033[0;32m $i exec $j success ! \033[0m"
ssh -p 22 root@$j "cd /home/$i/ && s