I'm trying to convert from kermit to lftp. The old script takes the commands from another script for to/from location for the files. I want to still take that input file, but I'm having trouble getting it to read commands from the input file.
old utils script using kermit:
/appl/bin/kermit $M_SCRIPT_TMP_FILE | sed -e '/^$/d' -e 's/^/ /' >> ${LOGFILE:-/home/mcleary/k_test/michele/logs/default.log} 2>&1
Where kermit version $M_SCRIPT_TMP_FILE contains contents from each script doing ftp (lcd line down) :
ftp open MMMMSITE /USER:useruser /PASSWORD:pwpw
LOG TRANSACTIONS /app/tmp/m_Ftp_trans.tmp
lcd /home/mcleary/k_test/michele/
cd trans/
ascii
put test3.txt
exit
The lftp script using the input file looks like this:
/usr/bin/lftp -f $M_SCRIPT_TMP_FILE | sed -e '/^$/d' -e 's/^/ /' >> ${LOGFILE:-/home/mcleary/k_test/michele/logs/default.log} 2>&1
For the lftp version, the input file looks like this:
open ftp://useruser:pwpw://MMMMSITE
LOG TRANSACTIONS /app/tmp/m_Ftp_trans.tmp
lcd /home/mcleary/k_test/michele/
pwd
cd trans/
ls
put test4.txt
bye
The output/error message for lftp is:
open: ftp: Name or service not known
cd: Not connected
ls: Not connected
put: Not connected
Exit Status - m_Ftp2: 0
m_cmd from ckcmd: m_exit
m_log_only from ckcmd:
Any ideas why lftp isn't recognizing the ftp input line?
UPDATE: I know lftp works from command line like this, but I need to give input file:
lftp -u useruser,pwpw ftp://MMMMCO <<EOF
> lcd /home/mcleary/k_test/michele/
> cd transfer
> put test.txt
> bye
> EOF
UPDATE2: I tried new utils script using lftp like this:
open -u useruser,pwpw ftp://MMMMSITE
This is output message:
cd: Login failed: 530 User cannot log in.
ls: Login failed: 530 User cannot log in.
put: Login failed: 530 User cannot log in.
Exit Status - m_Ftp2: 0
m_cmd from ckcmd: m_exit
m_log_only from ckcmd:
I got it working.
filename.txt:
open ftp://MMMMSITE -u useruser,'pwpw'
lcd /home/mcleary/k_test/michele/
pwd
cd trans/
ls
put test5.txt
bye
Then to use that file:
lftp -f filename.txt