If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Ftp Script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-04, 03:23
tahirkhalil tahirkhalil is offline
Registered User
 
Join Date: Feb 2004
Posts: 9
Red face Ftp Script

I am using a script to automatically download my incremental backups to my backup server. I have created a script which is executed after every 40 minutes in order to update the backup server. I used ftp "ftp -n" for this purpose. Facing a problem that if the link between backup server is not available or there is any problem with file dumping at backup server - I cannot catch the exceptions - I mean error codes. FTP Always returns 0 (successful) even the Backup server is not available. Is there any remedy for that?
Reply With Quote
  #2 (permalink)  
Old 11-30-04, 09:45
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

You could try and 'ping' the server first
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 11-30-04, 09:54
tahirkhalil tahirkhalil is offline
Registered User
 
Join Date: Feb 2004
Posts: 9
Wink Ping

the ping is a good solution if you want to check the availability of the server - fine - but what happened when there is some break in connection b/w these two servers?

I am exactly looking at EXIT STATUS solution - which could help me to sort out.

Thanks anyway !
Reply With Quote
  #4 (permalink)  
Old 11-30-04, 11:11
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Quote:
Originally Posted by tahirkhalil
the ping is a good solution if you want to check the availability of the server - fine - but what happened when there is some break in connection b/w these two servers?

I am exactly looking at EXIT STATUS solution - which could help me to sort out.

Thanks anyway !
Unfortunately there is no EXIT STATUS solution, you may have to re-direct the ftp output to a log file and then 'grep' this file for errors.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #5 (permalink)  
Old 11-30-04, 11:28
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
Quote:
Originally Posted by LKBrwn_DBA

Unfortunately there is no EXIT STATUS solution, you may have to re-direct the ftp output to a log file and then 'grep' this file for errors.
and also as a FYI:
http://www.ftpplanet.com/ftpresources/ftp_codes.htm
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #6 (permalink)  
Old 12-24-04, 07:12
vyjaikumar vyjaikumar is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
Exclamation Using ftp libraries!

hi,
I had the same problem and I have a different solution for the same!
You can use ftp library files available in the net, so that you can automate ftp in c and monitor the return status of every get/put commands.

I downloaded the one from the following link:
http://www.linuxsoft.cz/en/sw_detail...m=3449#diskuze

Thanks,
vijayakumar
Reply With Quote
  #7 (permalink)  
Old 12-27-04, 14:34
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Or, if you do not want to program, you could use expect.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #8 (permalink)  
Old 01-27-05, 00:24
beefa beefa is offline
Registered User
 
Join Date: Jun 2004
Posts: 2
Ftp

Hi,

I have a FTP program that I can connect to with users and gropus and that set up. Is there a script on the net that I can intergrate into my website to log into the server?

Thanks,
Beefa
Reply With Quote
  #9 (permalink)  
Old 01-27-05, 08:48
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #10 (permalink)  
Old 01-30-05, 18:13
kapilraj kapilraj is offline
Registered User
 
Join Date: Jan 2005
Location: India
Posts: 6
One of my friend suggested me the following perl

#!/usr/bin/perl
use Net::FTP;
$ftp=Net::FTP->new("$hostname");
$ftp->login("$user","$password");
$ftp->get("$file") or die "Oh dear file didn't come over properly\n";
$ftp->quit;
exit 0;

Kaps
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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