× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Some issues have arisen. I don't know if there is a way to detect them.

A coworker sends huge files, 500M+, every day. Yesterday, the expect script did
not even make it past the password prompt. No file transfer happened. The
expect script ran to the bottom. There was code to retrieve the status of the
last command. But, it was zero, so no error.

Today, same script, different huge data files. Script runs to completion. No
idea if the data files arrived on the remote site. Below is my expect script,
slightly edited to remove actual destination:

#!/bin/sh

build_script() {

cat <<End-of-message
#!/usr/local/bin/expect -f
set timeout 20
spawn sftp -v ${USER}@ftp.xxx.com
expect "Connecting to ftp.xxx.com...\r\n"
expect "password:"
send "${PASSWORD}\n"
expect "sftp>"
send "put ${PUTFILE} \n"
expect "sftp>"
expect "sftp>"
send "put ${PUTFILE2} \n"
expect "sftp>"
send "quit\n"
exit
End-of-message

}

build_script | /usr/local/bin/expect -f -



Is there something there that causes the actual file transfer to occur
asynchronously, thus not allowing the status to be known to the original
caller?

This is the CL that calls the sFTP script:

CALL QP2SHELL PARM('/usr/bin/sh' '-b' +
'/usr/local/bin/xxx.scr')

/* Check for sFTP error */
CALL PGM(QUSRJOBI) PARM(&RCVVAR +
&RCVVARLEN +
'JOBI0600' +
'*' +
' ' )
IF (%BIN(&RCVVAR 109 4) *NE 0) DO

With the inclusion of the '-b', I am guessing that is why the sFTP is running
asynchronously. My guess. This looks like the only thing that is checked is
whether some part of QP2SHELL has completed, but not the entire script. Is
there some way to pause the CL until the underlying QP2SHELL has completed?

John McKee


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.