The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-04-2007
mahalakshmi mahalakshmi is offline
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
  #2 (permalink)  
Old 04-04-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
have a look here, might help you
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0