简要集群复制shell脚本

#!/bin/bash
# find out my ip to exclude...
MY_MERCHINE_IP=`ifconfig eth0 |awk -F "[: ]+" '/inet addr/{print $4}'`;
MERCHINE_IP_LIST="172.1.2.7 172.1.3.4";
for m_ip in $MERCHINE_IP_LIST;
do
        if [[ $m_ip != $MY_MERCHINE_IP ]]; then
                echo "- Installing apps to mechine@${m_ip} ...";
                # install api apps
                scp /www/test/hello-1.0.0-SNAPSHOT.jar root@${m_ip}:/www/test/
                rsync -av --delete /www/html/ root@${m_ip}:/www/html/
                echo "- Install apps to merchine@${m_ip} done.";
        fi;
done;
posted @ 2020-09-20 10:15  kylingx  阅读(135)  评论(0编辑  收藏  举报