【发布时间】:2018-08-09 15:34:00
【问题描述】:
我正在尝试将一组文件通过 ftp 传输到客户端服务器。我尝试使用 ftp 将其自动化,因为我们还没有 SSH 密钥设置。我已将目标主机(名称、UN、PW)存储在 .netrc 文件中。当脚本执行时,它会打开 ftp 终端并停止。如何在打开 ftp 终端后继续执行脚本?你们能帮忙吗?
#!/bin/ksh
cd /scripts
. ./getYesterdayDate.sh
today=${YESTERDAY_DT}
today=`echo $today | sed 's/-//g'``
echo "Today is $today"
#Copying file from Source server
/usr/local/bin/scp UN@HOST:/backup/abc*.$today /scripts
#Renaming the files to custom names in the intermidatory server
cd /scripts
rm abc.data
touch abc.data
cat abc.data.$today >> abc.data
chmod a+r *
mv abc.START.$today abc.START
mv abc.END.$today abc.END
#FTPing to the DESTINATIONSERVER
/usr/bin/ftp DESTINATIONSERVERenter code here
cd /test
put abc.START
put abc.END
put abc.data
#In the above statements, when ftp is successful, instead of taking "cd /test" as input, terminal just stays at "ftp>"
echo "Upload for $today" | mailx -s "Successfull" name@domain.com
谢谢
【问题讨论】: