如何实现通过SCP从一台服务器定时传送文件到另一台服务器

sh/bash/dash/ksh/zsh等Shell脚本
回复
hongweijun
帖子: 1
注册时间: 2016-12-17 12:55
系统: ubuntu

如何实现通过SCP从一台服务器定时传送文件到另一台服务器

#1

帖子 hongweijun » 2016-12-17 13:36

ubuntu系统
如何实现从服务器A:192.168.1.1将/tftp/shanghai-mac.txt文件定时传送文件到服务器B:192.168.1.2 /tftptest目录下,并将文件命名为:shanghai+当前时间
1:shell脚本 /tftp/scp.sh
#!/usr/bin/expect
set timeout 30
ext=`date +%y%m%d%H%M%S`
file=shanghai`$ext`
spawn scp /tftp/shanghai-mac.txt root@192.168.1.2:/tftptest/$file
expect"*password:"
send"$passwordr"
expect eof.

大家帮我看看这个有什么问题
回复