1821187 Members
3378 Online
109631 Solutions
New Discussion юеВ

SFTP -b batchfile

 
SOLVED
Go to solution

SFTP -b batchfile

I would like to be able to use SFTP with a batchfile. As I understand it SFTP does not work in batch mode.
My command looks like this
$ sftp -b batchfile.txt 'user'@'node'

in batchfile.txt
ls
bye

The command produces no output, no errors. SSH en SCP works fine.
I probably am doing something stupid simple wrong. Anybody out there using this command the same way and can you provide me with an example batchfile?

Bart
Resistance is not an option.
20 REPLIES 20
Karl Rohwedder
Honored Contributor

Re: SFTP -b batchfile

Bart,

isn't the batchoption -B, so the command should be sftp "-B"?

regards Kalle

Re: SFTP -b batchfile

Kalle,
I've tried it but I do not receive any output from the commands in my batchfile. Do you have an example?
Resistance is not an option.
Karl Rohwedder
Honored Contributor

Re: SFTP -b batchfile

I'm afraid not.
I just noticed, that in the manual it states -b and the sftp -h states -B.

regards Kalle
Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

sftp "-h"
Usage: sftp2 [-D debug_level_spec] [-b batchfile] [-S path] [-h] [-V] [-P ssh2-port] host
Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

sftp "-bcmd.txt"
sftp "-bcmd.txt" "-D 7"

Re: SFTP -b batchfile

;-)
Peter,
I've found out this switch. But it doesn't help me at all.

I would like to know if
$ sftp "-B" batchfile 'user'@'node'
works at all when I put
get a.a
bye
in the batchfile.

am I really this stupid or the onlyone to use this?
Resistance is not an option.

Re: SFTP -b batchfile

Ok,
now....what is the content of the cmd.txt in your case?
Resistance is not an option.

Re: SFTP -b batchfile

OK,
with a little help from my friends I discovered that it only works on OpenVMS if you use this syntax;
$ sftp "-Bbatch.txt" 'username'@'node'

be SURE!! to USE a at the end of each line in batch.txt execpt the last line.

*heavy sigh*.

Hope this helps others in their quest..
Resistance is not an option.
Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

Your command file must be record format stream_lf

Re: SFTP -b batchfile

are you just guessing? Mine is sequential and it works fine?
Resistance is not an option.
Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

Put the LFs in manually if you want...

Stream LF is a common requirements of 'non-native' VMS software, for example Apache etc.

Re: SFTP -b batchfile

and there used to be this feature in $EDT to get a character in it.....but I forgot how to do this...I still know that +]] gives but hey...whow needs this if you are looking for a

Resistance is not an option.
Karl Rohwedder
Honored Contributor
Solution

Re: SFTP -b batchfile

Entering in EDT:
10

10 is the decimal value of LF and is the special insert.

regards Kalle
Willem Grooters
Honored Contributor

Re: SFTP -b batchfile


The latter is lucklily not entirly true. Apache 1.3 works fine with VMS-native files, and upcoming 2.1 is said to be likewise.
But for the rest: always worth a try.

Your particular problem doesn't surprise me.
It is know that some of these "products" have issues other than this requiement. Be it in functionality, interface or "help" (the Unix way). It would be a good thing these were signalled and solved _before_ release....

To add a in editor (TPU): CTRL-V + CTRL-J (CTRL-V toggels to "binary mode", so you can insert a non-printable character. CTRL + character = binary valu├Г┬й to be inserted. CTRL-A = 1, CTRL-B = 2 etc. Only"one at a time. How it displays on screen depends on your terminal/terminal emulator.

Willem
Willem Grooters
OpenVMS Developer & System Manager

Re: SFTP -b batchfile

Thanks guys. Everything works out nicely now.
Resistance is not an option.
Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

Peter Barkas
Regular Advisor

Re: SFTP -b batchfile

http://h18012.www1.hp.com/java/documentation/1.3.1-7/ovms/docs/release_notes.html#streamlf
Stream_LF format is required for all data files read or written by Java programs.

I have managed to waste quite a lot of time with Apache and JAVA simply because my files were not in stream format, or at least that what I thought was the case, perhaps I was wrong.

See also [APACHE]APACHE$CONVERT_STREAMLF.COM

Re: SFTP -b batchfile

Topic closed
Resistance is not an option.
ted_72
New Member

Re: SFTP -b batchfile

I have the same problem, where do you enter the password, and what is the PFK3 or PF keys? thanks
Ian Miller.
Honored Contributor

Re: SFTP -b batchfile

gold key is PF1 on VT keyboard.
____________________
Purely Personal Opinion