#!/bin/ksh
. $HOME/bin/init.ksh
# log_start
exit_if_not_dgftp
# EXPIRE_DAYS=30
# create_arc_dir
# handle_error abort $? "Command create_arc_dir failed" $USER
# purge_archive $EXPIRE_DAYS
WORK_FILE=RetriesExceeded.csv
USER=LawsonIT-FinMM@test.org
HOST=lawsonfax.test.org
# Ftp the file
# Ftp username and password is in .netrc
$FTP -v $HOST
lcd $WORK_FILE
get RetriesExceeded.csv
quit
# archive_file $WORK_FILE
# /law/bin/mpack -s "Fax Retries Exceeded" $WORK_FILE_OUTPUT $USER
# log_stop
exit 0
[dgftp@lawapp2]/lawif/bin$ get_lawson_fax.ksh
Connected to lawsonfax
220 Microsoft FTP Service
331 Password required for dgftp.
230 User logged in.
ftp> quit
221 Goodbye.
/lawif/bin/get_lawson_fax.ksh[33]: lcd: not found
/lawif/bin/get_lawson_fax.ksh[34]: get: not found
/lawif/bin/get_lawson_fax.ksh[35]: quit: not found
[dgftp@lawapp2]/lawif/bin$
说明:该脚本可以很好地连接到Lawson传真服务器,但是在FTP提示符处停止。我可以交互式输入“ Get”,它可以工作,但是在KSH脚本中,它仅在ftp提示符下停止,然后在退出时给出三个未找到的错误。如果我使用的是AIX服务器上的FTP,请手动打开FTP,打开lawsonfax,获取retriesexceed.csv,提取文件没有问题。
答案 0 :(得分:0)
尝试使用shell重定向:
ftp -v "$HOST" <<DONE
lcd $WORK_FILE
get RetriesExceeded.csv
quit
DONE