LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2009, 02:03 AM   #1
solar05
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Rep: Reputation: 0
Exit status of SFTP


Hello to everybody.
I copy files from host to host via sftp.
Sometimes connection via hosts may be down.

When SFTP copy files to remote host and connection breaked
SFTP session hung... And script also hung. How I can see it? And break the session?
 
Old 07-07-2009, 06:21 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,383
Blog Entries: 55

Rep: Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558Reputation: 3558
Quote:
Originally Posted by solar05 View Post
How I can see it?
SFTP allows you to use some SSH options like ConnectionAttempts, ConnectTimeout, LogLevel, ServerAliveInterval, ServerAliveCountMax. So by monitoring (verbose?) process output you might be able to grep for problems or stalling.


Quote:
Originally Posted by solar05 View Post
And break the session?
A crude way could be to use a timer that starts when the SFTP transfer starts and watches for changes in (verbose) transfer output. If nothing changes in n minutes you could conclude the transfer stalled (or was broken off reading exit status "$?") and kill the transfer PID.
 
Old 07-07-2009, 07:43 AM   #3
solar05
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
SFTP allows you to use some SSH options like ConnectionAttempts, ConnectTimeout, LogLevel, ServerAliveInterval, ServerAliveCountMax. So by monitoring (verbose?) process output you might be able to grep for problems or stalling.



A crude way could be to use a timer that starts when the SFTP transfer starts and watches for changes in (verbose) transfer output. If nothing changes in n minutes you could conclude the transfer stalled (or was broken off reading exit status "$?") and kill the transfer PID.
On Solaris this options don't exist ConnectionAttempts, ConnectTimeout, LogLevel, ServerAliveInterval, ServerAliveCountMax...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit status vedanu Programming 4 06-23-2007 05:13 PM
Problem with sftp! (debug1: Exit status 127 Connection closed) nena Linux - Security 1 01-26-2006 07:29 PM
> Ftp With Exit Status, Ftp with exit status vwvr9 Linux - General 4 02-23-2005 02:53 AM
exit status naflan Programming 2 10-22-2004 12:22 PM
pppd exit status 1 wolfe2554 Linux - Networking 2 04-14-2004 12:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration