Sftp hanging


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sftp hanging
# 1  
Old 09-27-2013
Question 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.

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


Last edited by Scott; 09-27-2013 at 06:11 AM.. Reason: Duplicate thread. Closed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sftp hanging at exit

Hi All I was trying to execute below sftp command. echo "cd /${CUST_ID}/inbound/${SAFET_ID}" > $BATCHFILE echo "put ${SOURCE_FILE} ${FILE_NAME}" >> $BATCHFILE echo "exit" >> $BATCHFILE cmd="sftp -o port=2022 -b $BATCHFILE user@$SERVER" $cmd >> $LOGFILE 2>&1 if 2>>$LOGFILE then... (3 Replies)
Discussion started by: Girish19
3 Replies

2. UNIX for Dummies Questions & Answers

netstat -a is hanging??

Hi, I am on Solaris 10 server. I wanted to see a port is ESTABLISHED or in the LISTEN mode. But when I do netstat -a |grep 22205, it's hanging. I have waited over two minutes. Is it possible, something else is wrong on the server? I don't see anything on /var/adm/messages file. ... (3 Replies)
Discussion started by: samnyc
3 Replies

3. Solaris

df command hanging

Hi Folks, When i execute the command df -kh in my system the o/p hangs.. The command runs fine but takes a lot of time before coming back to the # prompt. Can anyone please suggest the possible cause and solution?. (10 Replies)
Discussion started by: vivek.goel.piet
10 Replies

4. UNIX for Dummies Questions & Answers

Process Hanging

Hi! I have written a program three threads will be created to execute three different Sybase SQLs. so three thread will call a method runQuery. In run query again we create child process to execute the actuall SQL by connecting to the SQL. When I run the process first three threading working fine.... (0 Replies)
Discussion started by: jramesh1
0 Replies

5. Shell Programming and Scripting

script hanging???

ok... this is where i am at... i need a script to call another script as a wrapper because the first script creates a sub-shell. here is what i got... i kick off the first script "CCBDEMO-threadpoolworker.sh" #!/bin/bash clear #clearing screen directory="/data1/spl/cis/CCBDEMO/bin"... (1 Reply)
Discussion started by: Dagaswolf
1 Replies

6. Shell Programming and Scripting

Script is hanging

Hello, I have the following shell script and when i execute, it keeps hanging and nothing happens Please let me know. Requirement is to read data from file and pass it to the sql and create files as shown. code /******** #!/bin/sh while read user.dat do echo "user = $1 email =... (1 Reply)
Discussion started by: rakeshsr12
1 Replies

7. UNIX for Dummies Questions & Answers

Hanging port?

Ok, this question my be different. I can ping our unix box, but when we I to access the webpage I cant. To access the webpage I type http://ipaddress:some port. How do I check if a port is hanging and how would I un hang it. Sorry if question doesnt make sense. (1 Reply)
Discussion started by: NycUnxer
1 Replies

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

9. UNIX for Dummies Questions & Answers

ps command is hanging

Hi All, I am unable to figure out why my ps command is haning. Is some one else is running a process which is hanged. But in that case also if i do ps it should show only the processes running by me only. Thanks & Regards Gauri Agrawal (2 Replies)
Discussion started by: gauri
2 Replies

10. UNIX for Dummies Questions & Answers

how to tell if process is hanging

On Solaris 8.. 28166 user 3693M 2736M sleep 5 0 0:05.38 0.0% PROCESS/4 How can I tell if this process is doing anything or just hanging? (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question
SSH2_SFTP_MKDIR(3)							 1							SSH2_SFTP_MKDIR(3)

ssh2_sftp_mkdir - Create a directory

SYNOPSIS
bool ssh2_sftp_mkdir (resource $sftp, string $dirname, [int $mode = 0777], [bool $recursive = false]) DESCRIPTION
Creates a directory on the remote file server with permissions set to $mode. This function is similar to using mkdir(3) with the ssh2.sftp:// wrapper. PARAMETERS
o $sftp - An SSH2 SFTP resource opened by ssh2_sftp(3). o $dirname - Path of the new directory. o $mode - Permissions on the new directory. o $recursive - If $recursive is TRUE any parent directories required for $dirname will be automatically created as well. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Creating a directory on a remote server <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $sftp = ssh2_sftp($connection); ssh2_sftp_mkdir($sftp, '/home/username/newdir'); /* Or: mkdir("ssh2.sftp://$sftp/home/username/newdir"); */ ?> SEE ALSO
mkdir(3), ssh2_sftp_rmdir(3). PHP Documentation Group SSH2_SFTP_MKDIR(3)