Sftp hanging at exit

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sftp hanging at exit
# 1  
Old 09-25-2013
Sftp hanging at exit

Hi All

I was trying to execute below sftp command.

echo "cd /${CUST_ID}/inbound/${SAFET_ID}" > $BATCHFILE
echo "exit" >> $BATCHFILE
cmd="sftp -o port=2022 -b $BATCHFILE user@$SERVER"
$cmd >> $LOGFILE 2>&1
if [ $ret -ne 0 ] 2>>$LOGFILE
echo "Failure" >> $LOGFILE
echo "Success">> $LOGFILE

But in log i can see the output till exit. sftp is hanging at exit, if-else condition is not getting executed.

Request you to suggest a solution
# 2  
Old 09-25-2013
Can you run this manually by the same user account non-batch mode first, and if so, can you run this with the commands in a batch? That might give a clue as to why this might be getting stuck.

I hope that this helps

# 3  
Old 09-25-2013
Hi thanks for the reply. But i cant execute from the same user. The script is getting called from GUI

---------- Post updated at 09:27 PM ---------- Previous update was at 09:25 PM ----------

And one more important thing is this issue is happening randomly. Not frequently.
# 4  
Old 09-27-2013
This may be more indicative of network problems than sftp problems, I'm thinking. How large are these files you're uploading?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Exit Status 255, Connection closed in SFTP

I'm trying to connect from Server A to Server B to transfer files from A to B. I'm using NUID A1 in Server A and NUID A2 in Server B. I have done the following the steps to setup password-less login. 1. Add the public key of A1 in A to the Authorized keys of A2 in B. 2. Add the public key of... (4 Replies)
Discussion started by: sanchid312
4 Replies

2. UNIX for Advanced & Expert Users

Need a exit from sftp if its ask for password and continue to run remaining part of script.

Hi I am checking status of sftp in Health check script, sftp command is used to connect the server with secure RSA key, which is successfully get connected most of the time but in some case if RSA key ask for password then I need to exit sftp command after few second and continue to run... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. Shell Programming and Scripting

Difference between exit, bye and quit in sftp

Hi All, I would like to know whether is there any difference in closing the sftp connection with exit, bye and quit. And would like to know the reliable command. (3 Replies)
Discussion started by: Girish19
3 Replies

4. Shell Programming and Scripting

Sftp hanging

Hi All, I am transfering a file through sftp. But the script is hanging at exit occasionally. I am suspecting that sftp is hanging due to buffer size issue. If that is the case can any body suggest a solution. Please find the code. echo "cd /${CUST_ID}/inbound/${SAFET_ID}" >... (0 Replies)
Discussion started by: Girish19
0 Replies

5. Shell Programming and Scripting

How to Log No Connect Error and then Exit using SFTP?

Solaris 10 9/10 BASH using the following code snippet: sftp $TOHOST <<RESULT cd /inbound/ lcd /transfer put $i bye I want to log no server connections and the kill the script after the log entry was made. How would I do... (2 Replies)
Discussion started by: os2mac
2 Replies

6. Solaris

Exit status 255 on sftp

HI guys When i try SFTP to a machine using a user account whose entry in /etc/passwd as follows user:x:8005:508::/export/home/user:/bin/false and i am not placed my keys over there i am using the password option in the sftp Since the keys are not there it ask for the password ... (5 Replies)
Discussion started by: GIC1986
5 Replies

7. Shell Programming and Scripting

How to get the exit satus of a command which I executed in sftp prompt

Hi All, I need the exit status of a command which is executed through sftp connection. Example: sftp user@host <<EOF mkdir /home/karteek/testing put /home/xyz.txt /home/karteek/testing EOF ------ In the above example, I need the exit status of the put command. Please help me. ... (2 Replies)
Discussion started by: Karteek
2 Replies

8. Shell Programming and Scripting

Exit codes in SFTP

HI All, I have created a unix script which takes 2 parameters and using sftp tranfers files to remote location following is the script #!/bin/ksh # # # Parameter 1 is the complete path of the destination server # Parameter 2 is the complete path of the file which is to be FTP... (1 Reply)
Discussion started by: vikramsnest
1 Replies

9. UNIX for Advanced & Expert Users

sftp hanging on exit

Hi, I am doing a sftp from solaris 2.8 box to windows XP box. I am able to transfer the files successfully from the windows box to Solaris box (that is only I need). Problem arises when I try to exit/quit from the sftp session. sftp gets hung and I have to kill the telnet session by closing... (1 Reply)
Discussion started by: max29583
1 Replies

10. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies
Login or Register to Ask a Question