#!/usr/bin/expect -f #Author by Jack #date is 2016-07-15 set password 7oeYePuGytdMVmEV #设置awstats服务器的密码 set date [exec date +%Y%m%d] #设置时间的方式,今天的时间 #set date [exec date -d "yesterday" +%Y%m%d] #设置昨天的时间 #upload remote host spawn /usr/bin/scp -r /logs/nginx/awstatslog/access_log${date}app-nginx1 sysadmin@10.10.10.49:/tmp set timeout 3 expect { "yes/no" {send "yes\r";exp_continue} } expect "sysadmin@10.10.10.49's password:" set timeout 3 send "$password\r" set timeout 300 send "exit\r" expect eof
expect 脚本
原创zhangjiehq ©著作权
©著作权归作者所有:来自51CTO博客作者zhangjiehq的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:nginx日志文件格式转换

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章