How to Employ SFTP on Today's MPE
July 9, 2014
Is anyone using SFTP on the HP 3000?
Gavin Scott, a developer and a veteran of decades on MPE/iX, says he got it to work reliably at one customer a year or so ago. "We exchanged SSL keys with the partner company," Scott said, "and so I don't think we had to provide a password as part of the SFTP connection initiation."
At least in my environment, the trick to not having it fail randomly around 300KB in transfers (in batch) was to explicitly disable progress reporting -- which was compiled into the 3000 SFTP client as defaulting to "on" for some reason. I forget the exact command that needed to be included in the SFTP command stream (probably "progress <mumble>" or something like that), but without that, it would try to display the SFTP progress bar. This caused it to whomp its stack or something similarly bad when done in a batch job, due to the lack of any terminal to talk to.
As SFTP is a pure Posix program, I ended up making Posix-named byte-stream files for stdin and stdout, and generally did all the SFTP stuff from the Posix shell. The MPE job ended up being a bunch of invocations of SH -c to execute an echo command to make the stdin file, and then another SH -c to run SFTP with a ;callci setvar varname -- $? or something like that -- on the end to capture the Posix process exit code back into the CI.
I also parsed/grepped the stdout file after the SFTP completed/exited, in order to test for seeing the actual file transferring message. I also wanted to make sure that all of the stdin content had been processed, so I could detect unexpected early termination or other problems that might not show up in $?.
That's all from memory, as I don't have access to the scripts any longer. In the end, SFTP was completely reliable, after working through all of its little issues.