Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Directing SFTP output to a file

 
SOLVED
Go to solution
Dan Letobar
Occasional Visitor

Directing SFTP output to a file

I'm having the same problem discussed in this thread

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1185836

I need to capture the output from the SFTP ls command to a file so I can search it.

When I do things the normal way:
$assign sys$output sftp.out
$sftp "-b" commands.dat user@node
$deassign sys$output
I get "Warning: Need basic cursor movement capablity, using vt100", and the output goes to the screen.

As soon as I use DEFINE/USER SYS$COMMAND NL:, either in the pipe command or issued separately before the sftp command, I get "FATAL: OpenVMS$tty_gettty() failed
%TCPIP-F-SSH_FATAL, non-specific fatal error condition"

Any idea why I'm getting the error, or any other way to redirect the output to a file?

Using '-o "batchmode yes"' gives me an illegal option error:
illegal option -- o
Usage: sftp2 [-D debug_level_spec] [-b batchfile] [-S path] [-h] [-V] [-P ssh2-port] host
8 REPLIES 8
Duncan Morris
Honored Contributor

Re: Directing SFTP output to a file

Dan,

welcome to the ITRC OpenVMS forum!

Here is a code snippet from a working script on Alpha 7.3-2, TCPIP 5.4 ECO 7

$
$ !---- Using 'pipe' produces a decent log file for us.
$ pipe (define/user sys$command NL: ; -
sftp "-B" "/xxxx_de/workfiles/''sftp_cmdfile'" 'xxxxde_username'@'xxxxde_ip' ; -
define/job/nolog sftp_stat &$status) | copy sys$pipe: 'sftp_logfile'
$ sftp_status = f$trnlnm("sftp_stat")


Regards,

Duncan
Dan Letobar
Occasional Visitor

Re: Directing SFTP output to a file

Thanks for the help and the welcome!

The pipe command you have above is exactly what I tried. When I type the 'sftp_logfile' I get:

$ type sftp.out
FATAL: OpenVMS$tty_gettty() failed
%TCPIP-F-SSH_FATAL, non-specific fatal error condition
%NONAME-F-NOMSG, Message number 0764CFBC

One thing I notice is; it appears I have a different version of SFTP. Mine requires "-b" instead of "-B" and doesn't have a -o option. Not sure if that has anything to do with anything.
Thanks.
Steven Schweda
Honored Contributor

Re: Directing SFTP output to a file

> Using '-o "batchmode yes"' gives me an
> illegal option error:
> [...]

Sometimes it's helpful to show the actual
command(s) used. Around here, no complaint:

alp $ sftp -o "batchmode yes"
sftp> quit

Disclosing some relevant software versions
might not hurt, either.

alp $ tcpip show version

HP TCP/IP Services for OpenVMS Alpha Version V5.4 - ECO 7
on a COMPAQ Professional Workstation XP1000 running OpenVMS V7.3-2

alp $ sftp "-V"
alp$dka0:[sys0.syscommon.][sysexe]tcpip$ssh_sftp2.exe: SSH Secure Shell OpenVMS
(V5.5) 3.2.0 on COMPAQ Professional Workstation - VMS V7.3-2
Dan Letobar
Occasional Visitor

Re: Directing SFTP output to a file

Here's the actual commands and output. I should also mention, I am able to sftp, its just when I include the DEFINE/USER SYS$COMMAND NL: command that I get the errors listed above. Without the DEFINE/USER SYS$COMMAND NL: command, the output goes to the screen.
Thanks.

$ sftp -o "batchmode yes"
illegal option -- o
Usage: sftp2 [-D debug_level_spec] [-b batchfile] [-S path] [-h] [-V] [-P ssh2-p
ort] host

$ tcpip show version

HP TCP/IP Services for OpenVMS Alpha Version V5.4 - ECO 1
on a hp AlphaServer ES47 7/1000 running OpenVMS V7.3-2

$ sftp "-V"
dsa0:[sys0.syscommon.][sysexe]tcpip$ssh_sftp2.exe;1: SSH Secure Shell OpenVMS (V
1.0) 2.4.1 on hp AlphaServer ES47 7/1000 - VMS V7.3-2
Duncan Morris
Honored Contributor

Re: Directing SFTP output to a file

Oh dear, that early version of TCPIP services was not brilliant at handling batch mode sftp.

Have a look at the release notes for ECO 7 for details of the later fixes.

ftp://ftp.itrc.hp.com/openvms_patches/alpha/V7.3-2/DEC-AXPVMS-TCPIP-V0504-15ECO7-1.txt

It is also vital that your batch file is in stream_lf format.

The option for batch mode is capital B, so needs to be in quotes, as mentioned in the notes.

Duncan
Steven Schweda
Honored Contributor

Re: Directing SFTP output to a file

> Oh dear, [...]

I'll say. Yikes.
Dan Letobar
Occasional Visitor

Re: Directing SFTP output to a file

Thanks for the info. What do we need to do to upgrade?
Martin Vorlaender
Honored Contributor
Solution

Re: Directing SFTP output to a file

>>>
What do we need to do to upgrade?
<<<

Download

ftp://ftp.itrc.hp.com/openvms_patches/alpha/V7.3-2/DEC-AXPVMS-TCPIP-V0504-15ECO7-1.PCSI-DCX_AXPEXE

to the machine, RUN the file, and then PRODUCT INSTALL the resulting PCSI kit.

cu,
Martin