首页 > 其他 > 详细

CentOS6.5文件同步分发脚本

时间:2016-07-19 13:59:05      阅读:212      评论:0      收藏:0      [点我收藏+]
   #!/bin/bash
   #push
   set -x
   ip1=xxx.xxx.xxx.xxx
   user1=root
   password1=root
   #----------------------
   ip2=xxx.xxx.xxx.xxx
   user2=root
   password2=password
   #-------------------
   source=/home/project/ORCA_WEB/target
   file=$(cd /home/project/ORCA_WEB/target;ls | grep ORCA_WEB*.war)
   echo ${file}
   
   #ssh -p 22 $user1@$ip1 ‘cd /home/orca/tmp; rm -rf *‘
   #ssh -p 22 $user2@$ip2 ‘cd /home/orca/tmp; rm -rf *‘
   
   cd ${source}
   
   ftp -niv <<- EOF
   open ${ip1}
   user ${user1} ${password1}
   $cd 
   bin
   put ${file} /home/orca/tmp/${file}
   bye
   EOF
   
   
   ftp -niv <<- EOF
   open ${ip2}
   user ${user2} ${password2}
   $cd 
   bin
   put ${file} /home/orca/tmp/${file}
   bye
   EOF
   
   #分发结束后,执行目标设备的脚本
   
   ssh -p 22 $user1@$ip1 ‘cd /home/orca/shell;bash ./replace.sh‘
   ssh -p 22 $user2@$ip2 ‘cd /home/orca/shell;bash ./replace.sh‘

CentOS6.5文件同步分发脚本

原文:http://11802086.blog.51cto.com/11792086/1827665

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!