FTP error handling - critical


 
Thread Tools Search this Thread
Operating Systems Solaris FTP error handling - critical
# 1  
Old 10-27-2010
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: delete backup files from source server.

Problem is that I am not able to find a way through which I can ensure backup files are successfully transferred (mput) and now its safe to delete backup files from source server.

Here is the shell script:

Code:
#!/bin/sh
#
BACKUPDIR="/export/home/myuser/backup"

HOST='ftp.xyz.com'
USER='user@xyz.com'
PASSWD='abc'
FILE='*.gz'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
lcd $BACKUPDIR
cd backups/source
binary
mput $FILE

quit
bye
END_SCRIPT

Any help is highly appreciated.

Bye
Viki
Note: Not a shell scripting/Solaris guy!
# 2  
Old 10-27-2010
Had a similar issue recently with sftp, it's not possible unless you log in with a new session and get a listing of the remote directory.
Better to use rsync or scp, they will at least give you a return code.
# 3  
Old 10-27-2010
Your idea is good. But when I try scp to remote server; I get "connection timeout". This remote server is of Yahoo where we have purchased domain and have infinite space. It is connecting with FTP but i think scp/rcp/rsync are disabled on it. How can we check that remote server - Yahoo support scp ? I have read Yahoo web hosting documentation but didn't find anything in this regard.

Bye
Viki.
# 4  
Old 11-01-2010
You have to edit your script. Use a loop from 1 to n where n is the number of your files. Also, use put instead of mput. and make a checksum on each file before you send it. do a remote checksum on the yahoo server on the same file. if the both values match delete the file, else resend it. exit the loop when you reach n+1.

please ask me if you need any help in you script
# 5  
Old 11-01-2010
To be honest for this task is maybe reasonable use expect script. I suppose that via this you can handle much more specific needs.
# 6  
Old 11-01-2010
If you 'tar' and 'gzip' them first, then you will only have a single file to send and compare. But, since this is source code, I would be inclined have the date as part of the file name and maintain multiple copies.
# 7  
Old 11-01-2010
what is the file name format?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SCO

Moving SCO Virtual Machine in VMWare Environment: Critical Licensing Error Messages

Some years ago our company chose to run a critical proprietary app under SCO Unix. My predecessor tried to move A SCO Unix virtual machine from our dedicated VMWare environment to a shared Cloud VMWare environment. My predecessor received licensing messages from these critical servers so... (2 Replies)
Discussion started by: timfox1234
2 Replies

2. 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

3. 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

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. UNIX for Dummies Questions & Answers

Error in terminal: Gtk-CRITICAL

Hi, I am using Ubuntu 10.04. Recently I have seen this error appear in my terminal as I edit text files with gedit: (gedit:2841): Gtk-CRITICAL **: gtk_widget_is_ancestor: assertion `ancestor != NULL' failed Any ideas on what this means? Mike (1 Reply)
Discussion started by: msb65
1 Replies

6. 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

7. 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

8. Shell Programming and Scripting

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??? ftp log ftp session start time is: Thu Jun 19 00:00:02 BST 2008 Not connected. Not connected. Interactive mode off. Not connected.... (1 Reply)
Discussion started by: vivek_damodaran
1 Replies

9. AIX

Critical error after adding 6 new disks in DS4300

Hello, This morning we have added 6 new disks (73 Gb) to our DS4300, then created a new Array en then created a logical drive, after this was done, teh following error occourd on the last 3 (new)disks: Date/Time: 22-4-08 6:56:26 Sequence number: 5472 Event type: 282D Event category:... (1 Reply)
Discussion started by: topper
1 Replies

10. Programming

CRITICAL 11/08/05 12:06:26 _getsockopt reports error. errno: 239

I am new to this socket programming stuff. I have a problem to fix.. i got the error message. "CRITICAL 11/08/05 12:06:26 _getsockopt reports error. errno: 239" can some please help me with this.. how do i go about fixing this error. thanx in advance.. (0 Replies)
Discussion started by: niks.20
0 Replies
Login or Register to Ask a Question