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
Transferring hidden files with scp matrixmadhan UNIX for Dummies Questions & Answers 13 01-16-2007 12:00 PM
Error transferring large file using sftp protocol prashant.patel Shell Programming and Scripting 0 09-07-2006 02:49 PM
transferring files using ftp but mantaining the dates 435 Gavea Shell Programming and Scripting 4 07-23-2006 08:48 AM
transferring files to and from remote computer yogi1 UNIX for Dummies Questions & Answers 6 05-28-2006 06:58 PM
FTP session expiring when transferring files... Need some solution aarora_98 Shell Programming and Scripting 4 12-13-2005 09:28 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-03-2007
Registered User
 

Join Date: Nov 2006
Posts: 38
FTP - To handle error while transferring files

Hi,
I had written an FTP script where in I loop through the directories and transfer the files from each and every directory of Windows to UNIX.

Now the problem is when

1. The connection is unable to be established I should return some error codes

2. When there is some system problem and the FTP doesnt happen also the error condition should be handled

I would like to know whether there are any ways to handle the error codes for all the above conditions.

I am currently modified the code to handle the problem like this in the following ways.

ftp -v -n -i ${IP_ADDRESS} <<==eoftp== >> $LOGFILE 2>&1
user ${USERID} ${PASSWORD}
lcd ${1}
cd ${2}
put ${3}
bye
==eoftp==
ret_val=$?
echo "After ftp: `date '+%d/%m/%Y %T'`" |tee -a $LOGFILE 2>&1
echo "ret_val..= ${ret_val}" |tee -a $LOGFILE 2>&1
if [[ ${ret_val} -ne 0 ]]
then
echo "FTP failed..." |tee -a $LOGFILE 2>&1
else
echo "FTP Successful..." | tee -a $LOGFILE 2>&1
fi


Do let me know the other codes to be checked for proper functionality with check for exceptions

Thanks
Mahalakshmi.A
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-04-2007
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 767
have a look here, might help you
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:12 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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0