Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
cancel
Showing results for 
Search instead for 
Did you mean: 

sftp batch not working

SOLVED
Go to solution

sftp batch not working

Hi all,
I'm trying to set up an SFTP batch file. When I execute the batch file it just hangs and eventually times out. I can connect and transfer the file interactively. I've sent my public key and am not prompted for a pw when logging on to the remote server. I'm on an rx4640 running 11.23. What do I have wrong?

sftp -b batchfilename.sftp mylogin@remote.com

Batch file:
sftp mylogin@remote.com>>EOF
put /home/rocky/somefile.csv
quit
EOF

Thanks,
Rocky
4 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: sftp batch not working

Hi Rocky:

You have:

sftp mylogin@remote.com>>EOF

Try:

sftp -b mylogin@remote.com << EOF

Regards!

...JRF...

Re: sftp batch not working

Hi,
Thanks for the reply - I made the change and it still hangs. Anything else I can look at?
Thanks,
Rocky
Steven Schweda
Honored Contributor
Solution

Re: sftp batch not working

> Batch file:
> sftp mylogin@remote.com>>EOF

I don't do much with SFTP, so I know nothing,
but I'd expect an SFTP batch file to contain
a list of SFTP commands, not a shell script.
So, these look out-of-place to me:
sftp mylogin@remote.com>>EOF
EOF
but these look plausible:
put /home/rocky/somefile.csv
quit
(although I'd expect "quit" to be optional).

If you want to use a shell script with a
here-document in it, then it's a shell
script, not an SFTP batch file.

Re: sftp batch not working

Hi,
I changed my batch file to:

put /home/rocky/somefile.csv
quit

and it works.
Thanks for the help,
Rocky