The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to detect failure from batch SFTP and SHELL operations chengwei Shell Programming and Scripting 2 05-28-2008 04:32 AM
strange net::SFTP Perl module debug entry csgonan Shell Programming and Scripting 2 10-11-2007 03:04 PM
ssh/sftp failure connection james_falco UNIX for Advanced & Expert Users 3 03-27-2007 08:19 AM
sftp shell that will validate files biglarrrr Shell Programming and Scripting 0 09-22-2006 04:42 PM
validate ruffenator Shell Programming and Scripting 3 01-22-2002 07:37 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2005
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 156
Validate Failure of SFTP in PERL

Hi All,

I have the following statement in my perl script.

sftp::get("ABC","DEF","abcdef","out","/tmp/config/data.xls")

Whenever this statement fails due to username/password problem, it justs exit the script.

I want to know how can i write my code separately for handling sucess and failure as this function does not return anything.

If you can provide multiple solutions i would be grateful.

Thanks,
Rahul.
Reply With Quote
Forum Sponsor
  #2  
Old 09-13-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,477
Try this (untested):

Code:
eval {
$sftp->get("ABC","DEF","abcdef","out","/tmp/config/data.xls");
}
if ($@) {
# error occurred
print STDERR "Error returned: $@\n";
} else {
print STDERR "Successfully retrieved\n";
}
Reply With Quote
  #3  
Old 09-19-2005
Registered User
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 156
Does not Work

This method does not work...
Reply With Quote
  #4  
Old 09-19-2005
Registered User
 

Join Date: Jul 2005
Posts: 11
SFTP from Unix

How to get the return value in Unix for SFTP? Success or failure...
How can we know that we have logged into another IP address or user account?
How can we know that we have pulled or pushed a file successfully from here to there?
Is there any return codes to indicate this?
Reply With Quote
  #5  
Old 09-19-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Thumbs up

Redirect the output to a log file and in log files grep for something like 100% Complete or Error etc.

rishi
Reply With Quote
  #6  
Old 09-23-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,477
Quote:
Originally Posted by rahulrathod
This method does not work...
For the purpose of information, would you describe what is not working in that snippet?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0