Handling ftp error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Handling ftp error
# 1  
Old 06-23-2008
Handling ftp error

I have a script which connects to remote server and ftp the files
It works fine, however if there is any failure in ftp connection can it be handled???

Code:
ftp log

ftp session start time is: Thu Jun 19 00:00:02 BST 2008
Not connected.
Not connected.
Interactive mode off.
Not connected.
Not connected.
Not connected.
success and proceed
ftp session end time is: Thu Jun 19 00:01:18 BST 2008

I have tried the following, but in vain

ftp -n $HOST > /tmp/ftp.worked 2> /tmp/ftp.failed <<END_SCRIPT
<code>
END_SCRIPT

EXITSTATUS=$?
if [ $EXITSTATUS != "0" ]
then
# handle the error...
fi


Can someone please help me?

Thanks
# 2  
Old 06-23-2008
you can try the debug flag -d as well as the verbose flag -v. check your ftp man page
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script FTP maintain error handling

Hi, I have ftp script like below How to insert an error handling, If the transfer failed then send mail to me. Actually, I just need the script to send an email if the FTP failed. How to put the email script within FTP script? Thank You Edy (5 Replies)
Discussion started by: edydsuranta
5 Replies

2. Shell Programming and Scripting

Error handling

Hello fellow UNIX gurus :) I have a problem regarding the script below: # Variables used in this shell. power=0 # Stores squared integer total=0 # Sum of all squared integers num=0 # Stores command line arguements # Provides error handling if command line... (5 Replies)
Discussion started by: Learn4Life
5 Replies

3. Shell Programming and Scripting

Error Handling

Below code works for different databases i.e. MYSQL and ORACLE The problem is for MYSQL in Block: if ; $? taking value accordingly but in case of ORACLE $? is always taking this value as zero (0). That is the reason in Oracle it always going in else Block in any case.. :( and in case of ... (4 Replies)
Discussion started by: ambarginni
4 Replies

4. UNIX for Dummies Questions & Answers

File not found handling in ftp script

I have a pattern for filename to be searched. I need to get the files from remote server Who are matching the file pattern. And i need to exit with non zero return code for: 1)No files found matching that pattern 2)More than one files matching the name pattern. If only one files is... (1 Reply)
Discussion started by: pandeesh
1 Replies

5. Shell Programming and Scripting

Help with Error Handling on Script

Hi, I need your guys help again. I run a script which check for some process status in a loop. when i check the process some of the process could throw an error, how can i check that inside my script. Thanks, RR (3 Replies)
Discussion started by: rrb2009
3 Replies

6. Solaris

FTP error handling - critical

Hi all, I have done google on the aforementioned subject. But didn't find any authentic way of checking 100% Successful FTP transaction. In my case I have critical backup of source code on daily basis. I have shell script which will: 1: "mput" backup files to remote server using FTP 2:... (8 Replies)
Discussion started by: viki250
8 Replies

7. Shell Programming and Scripting

Finger and error handling

I have this segment of code : cmd = "finger -m " $1 " 2>/dev/null | head -1" cmd | getline userinfo close(cmd) Sometimes finger returns no such user when given a user id. With the redirection to the default trash file i am getting rid of any screen "finger:no such user" messages. I also want... (2 Replies)
Discussion started by: beatblaster666
2 Replies

8. Shell Programming and Scripting

Error Handling

Helo Experts, I need a help in handling errors in shell script, wants my errors displayed in text file instead of command window.. My shell script is here; cd /cygdrive/s/Files for FILES in ./*.* do temp=`basename $FILES` if cp $FILES /cygdrive/r/CopyFile1/$FILES; then echo "copy... (5 Replies)
Discussion started by: CelvinSaran
5 Replies

9. Shell Programming and Scripting

FTP File transfer - Exceptions handling

Hello All, How we can capture the FTP file transfer status. I would like do the exceptions handling for the FTP file transfer My code is something like this... ftp -nvi $FTP_SRVR |& print -p user $UID $PWD print -p cd mydir print -p put $FILE_NAME print -p close print -p bye ... (3 Replies)
Discussion started by: amazon
3 Replies

10. Shell Programming and Scripting

SFTP Error Handling

Hi , Can any one tell me is there any standard method to track errors during sftp ? using which command i can track sftp errors ? i tried using echo $? . Most of the times i am getting error number 127 ,1, 255. whether it is constant numbers ? Please help me out. Thanks in advance (2 Replies)
Discussion started by: deepusunil
2 Replies
Login or Register to Ask a Question