SFTP error in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP error in UNIX
# 8  
Old 08-25-2016
there's no here-doc for the sftp block.
How do you expect this to work?
What are all these '| tee ' commands on the right?

Brrrr......
# 9  
Old 08-25-2016
I have a modification log and comments which i removed, hence 157 lines.

---------- Post updated at 10:21 PM ---------- Previous update was at 10:18 PM ----------

Quote:
Originally Posted by vgersh99
there's no here-doc for the sftp block.
How do you expect this to work?
What are all these '| tee ' commands on the right?

Brrrr......
The tee commands append the output of the commands(outside) sftp to the log file.
What's a here-doc.
The SFTP portion works just fine.. but when i parameterize it doesnt work..
# 10  
Old 08-25-2016
Forgive me if I seem to out of my mind - Its end of day and was a had week for me...
my 2 cents:
On top of RudiC remarks above
I dont quite understand this line ( the use??)
Code:
echo "Remote host is: $REMOTE_SERVER"                                                                           | tee -a $LOG_FILEPATH/$LOG_FILENAME

the tee that is which can lead to some strange issues...
and now:
Code:
sftp $USERNAME@$REMOTE_SERVER -omode=ascii >> $LOG_FILEPATH/$LOG_FILENAME  2>&1                        	        
ls /+showall																									
ls /+ mode=text,recfm=fb,lrecl=80,space=trk.8.1,release															
##quote site file=jes
pwd																												
lcd $LOCAL_DIRECTORY
lpwd																											
$DIRECTION $LOCAL_FILENAME $REMOTE_FILENAME																		
ls $REMOTE_FILENAME																								
cd //$REMOTE_DIRECTORY																							
ls /+mode=text,jesjobwait																						
lcd $BIN_PATH																									
lpwd																											
$DIRECTION $LOCAL_JOBNAME $REMOTE_JOBNAME																		
ls $REMOTE_JOBNAME																								
get /+/error.log 																								
quit
.
.
.

Please forgive me if Im worng but I have a very poor eyesight this week... Typos as well...
This looks like a heredoc syntax , and if it is the case then there is something wrong in the syntax as I see not the << redirection though
I suppose the quit must be in relation or I am missing even more in trying to understand the given code

So?
This User Gave Thanks to vbe For This Post:
# 11  
Old 08-25-2016
Thanks vgersh99, you were faster then me and I did not see the other tees haha
# 12  
Old 08-25-2016
For our new member

This explains what a here-doc is:

Here Documents

My understanding is the sftp works fine when in interactive mode and you transcribed down what you want your batch script to do

most sftp have a -b option for batch mode too...
This User Gave Thanks to vbe For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. UNIX for Dummies Questions & Answers

SFTP error between UNIX to iSeries (Write Failed Broken Pipe)

Hi, I am iseries resource and having Issue in one of the sFTP failures between one of my job (Unix --> iSeries). The response to sending machine (Unix) is "Write Failed Broken Pipe". Appreciate any help Available on why this Issue happens, how can we replicate the same, what fixes can... (1 Reply)
Discussion started by: hamelchauhan
1 Replies

3. UNIX for Dummies Questions & Answers

Sftp from UNIX to mainframe

Hi, I have many scripts where i have used sftp for file transfer from unix box to unix box.. Now that we have to sftp files from unix to mainframe, i would like to know if that is possible. I just tried in the same way i did from unix to unix, but i got the error as connection refused. Are... (2 Replies)
Discussion started by: dnat
2 Replies

4. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

5. Shell Programming and Scripting

SFTP in UNIX

I need create a Shell script to do the SFTP process. How can i provide username and password in the script.I had the below code.But it ask for password.How can i add user name and password in this code echo "OK, starting now..." sftp -b /dev/fd/0 testwasds3l<<EOF cd /opt/isproj/VOM/Scripts... (2 Replies)
Discussion started by: morbid_angel
2 Replies

6. Shell Programming and Scripting

sftp to UNIX host

Hi, I am writing a shell script that securely connects to an UNIX host and transfer file(abc.txt) from the local machine to the host. sftp user@host get abc.txt bye The code doesn't work.. It throws error at line 2: get :Unknown get command. How can I rectify this problem? (2 Replies)
Discussion started by: Kishore_1
2 Replies

7. Shell Programming and Scripting

SFTP from Unix to Windows

Hi all Not sure where I should be posting this so apologies if it's in the wrong section. I'm trying to set up a system where we can copy a file (get) from a Windows server to a Unix server using SFTP in an automated way. I've installed CoreFTP Server on the Windows server and can connect... (2 Replies)
Discussion started by: huskie69
2 Replies

8. Linux

SFTP on SCO Unix

Hi, I have a request to install sftp on the Sco Unix Server. Request you please let me know the process for the installation of SFTP on Sco Unix Server. Thanks & Regards Arun (2 Replies)
Discussion started by: Arun.Kakarla
2 Replies

9. Shell Programming and Scripting

Error copying files from Unix (Solaris10) to Windows Server 2003 using scp/sftp

Hi, I have generated a Public/Private Key Pair in Solaris Unix (source) server and deployed the Public key in Windows 2003(target) server .ssh directory of user profile. When i try to connect(ssh, scp, sftp) from Unix, i'm getting below error message. Sun_SSH_1.1, SSH protocols 1.5/2.0,... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

10. HP-UX

sftp from unix to NT

Hi, 1) I want help on SFTP,Some commands not working in SFTP,but working in FTP example: bin,ls -xt ,user. Any alternate methos for this 2) if I want download files from UNIX to NT,I am able to download,but file format not connverting according to UNIX format(in NT end of line \n,but in... (1 Reply)
Discussion started by: anthonykomma
1 Replies
Login or Register to Ask a Question