SFTP Script fails to transmit the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP Script fails to transmit the file
# 1  
Old 10-19-2012
SFTP Script fails to transmit the file

I have written a Unix Script to automate the process of File transfer from Our server to vendor Server but the automation Script fail when Progress meter is around 65-70% Complete. Why is this haapening?

See the Log File Contenet:
Code:
spawn sftp -o IdentityFile=/home/lawsched/ah_rsa XXX@YYY.com
Connecting to YYY.com
SSH Server supporting SFTP and SCP
sftp> cd /INBOUND
sftp> put /law/hrprdir/CTXX453_20121018
Uploading /law/hrprdir/CTXX453_20121018 to /INBOUND/CTXX453_20121018
/law/hrprdir/CTXX453_20121018    0%    0     0.0KB/s   --:-- ETA
/law/hrprdir/CTXX453_20121018    7%  480KB 480.0KB/s   00:12 ETA
/law/hrprdir/CTXX453_20121018   12%  832KB 467.2KB/s   00:12 ETA
/law/hrprdir/CTXX453_20121018   19% 1248KB 462.1KB/s   00:11 ETA
/law/hrprdir/CTXX453_20121018   28% 1824KB 473.5KB/s   00:09 ETA
/law/hrprdir/CTXX453_20121018   32% 2080KB 451.7KB/s   00:09 ETA
/law/hrprdir/CTXX453_20121018   38% 2464KB 445.0KB/s   00:09 ETA
/law/hrprdir/CTXX453_20121018   46% 3008KB 454.9KB/s   00:07 ETA
/law/hrprdir/CTXX453_20121018   54% 3520KB 460.6KB/s   00:06 ETA
/law/hrprdir/CTXX453_20121018   63% 4096KB 472.1KB/s   00:05 ETA

This is how Log File Looks and File is not transmitted.

Please help to resolve this issue.

Thanks in Advance.

Last edited by Franklin52; 10-19-2012 at 03:27 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 10-19-2012
# 3  
Old 10-19-2012
When I tried Manuall, File is transmitted. This issue happens only when using the Script.

Please advice.

Thanks

---------- Post updated at 08:55 AM ---------- Previous update was at 08:44 AM ----------

elixir Sinari:- Thanks for your quick response. I have no problem Transmitting the file Manually but it fails when I use the Script.
# 4  
Old 10-19-2012
I believe your problem is spawn - it has a daemon that will time out a process.
Look on your man page - there are two possible timers involved, if I remember correctly.

Consider using a here document:

Code:
sftp -o IdentityFile=/home/lawsched/ah_rsa XXX@YYY.com <<EOF
 cd /INBOUND
 put /law/hrprdir/CTXX453_20121018
 exit
EOF

Note the last EOF is in the leftmost column.
This User Gave Thanks to jim mcnamara For This Post:
# 5  
Old 10-19-2012
Simply you can use this.
Code:
ssh -x servername@ipadress
sftp> cd /INBOUND
sftp> put /law/hrprdir/CTXX453_20121018

# 6  
Old 10-19-2012
Jim Mcnamara: - Thanks for your response. I changed my script to reflect
sftp -o IdentityFile=/home/lawsched/ah_rsa XXX@YYY.com <<EOF

Since I already Transmitted the file and since it is a Weekly transmit, I have to wait till next transmit to see if this resolves the issues. I will let you know the outcome of this change.

---------- Post updated at 09:12 AM ---------- Previous update was at 09:05 AM ----------

Adhi:- It's not working

SSH Server supporting SFTP and SCP
Connection to XXX@YYY.com closed.

Thanks for your effort.
# 7  
Old 10-19-2012
@adhi -
Your code does not enable the sftp protocol. It is just an ssh connection without x11 forwarding.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Except script fails to check file exists or not in remote node

Dear members, The following expect script connects to remote node and check for the file "authorized_keys" in directory /root/.ssh in remote node. However the result is always found even if the file exist or doesn't exist. expect { "$fname" { send_user "found\n" } Any idea what is... (4 Replies)
Discussion started by: Sudhakar333
4 Replies

2. Shell Programming and Scripting

Bash script fails when run as file

The following bash script fails with error message: "./phpquery_KNBB_html_reader.sh: line 65: syntax error near unexpected token `done'" when do ./<scriptname> in the shell. However when I copy-paste the entire contents of the file directly into a shell environment it runs ok returning the intended... (2 Replies)
Discussion started by: BurritoSolution
2 Replies

3. Shell Programming and Scripting

Setuid not working in Linux as script fails to write to file.

Hi, I have the following 3 test files to test setuid bit which if it works I would like to implement in our application. However setuid doesnot seem to be having any impact on my test below.Following are the 3 files of interest in /tmp/ folder. $ ls -ltr *env* -rw------- 1 g332008 users 6... (23 Replies)
Discussion started by: waavman
23 Replies

4. Shell Programming and Scripting

File check script fails for multiple files

I want to check if any file with testing*.txt exists but my script fails if more than 1 file exists. It works fine for a single file if then echo "TEST21" fi -------------- bash: How do I fix this? Thanks Please use code tags next time for your code and data. (8 Replies)
Discussion started by: sumang24
8 Replies

5. Programming

SFTP fails from crontab but works from terminal

Dear community, I'm driving crazy with a strange issue. I have a simple script to transfer a file to a remote system:#!/bin/bash echo "put /tmp/server.log" > /tmp/server1_transfer.sftp sftp -b /tmp/server1_transfer.sftp user@10.99.1.2:Between client and server there is a SSH KEY, so if I run... (15 Replies)
Discussion started by: Lord Spectre
15 Replies

6. Shell Programming and Scripting

sftp script file movement

Hi, I am newbie in unix scripting, I have written a bash script of SFTP that transfer some files from one folder to another within a server , I have two folders test and temp in the directory /home/p5060/sxk124 , the temp folder(/home/p5060/sxk124/temp)contain the files which I through my... (5 Replies)
Discussion started by: KAREENA18
5 Replies

7. 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

8. Solaris

Script fails when generated output file reaches a particular size

Hi All, New to unix. Here is the problem. Running a script that extracts data from hyperion essbase and generates a file in unix. This script fails most of the times with a very low success rate. The data has increased a lot in the last few months resulting in the file being more than 2 gb. ... (2 Replies)
Discussion started by: noufalshaw
2 Replies

9. Shell Programming and Scripting

log file when the script fails !

i have a script that will retrive some info from database. The script is working fine but i have to add new feature in it when the script fails or retrive null result it should reflect in the log file. below the script AMR_Inactive.sh while read i do connect1=`sqlplus -silent... (3 Replies)
Discussion started by: ali560045
3 Replies
Login or Register to Ask a Question