一个发布脚本demo

from http://www.youyou13.com

 

------------------

#!/bin/bash

user=`whoami`
file_list="/opt/htdocs/game.${user}"    /要发布文件列表(相对目录)/
from="/opt/htdocs/game.${user}"         /本机文件源目录/
to="/opt/game/game.asia.test/game_for_test"   /目标机器目录/


/usr/bin/expect << EOF                       /expect语法,使用ssh通道的rsync,通过expect输入密码的交互过程/
spawn /usr/bin/rsync -aWv  --files-from=/opt/htdocs/game.${user}/file_list -e "/usr/bin/ssh -lsomuser -p53333" ${from}  192.168.1.33:/${to}
expect "Password: "
send "passwd123\r"
expect eof  exit
EOF

你可能感兴趣的:(expect,rsync,发布脚本)