The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to implement polling for a function using timer in C? naan High Level Programming 7 11-19-2007 12:00 AM
AIX Site bakunin News, Links, Events and Announcements 0 12-04-2005 09:14 PM
Polling/Interrogate Directory Questions dnidiffer Shell Programming and Scripting 1 06-14-2005 06:20 PM
Help - Polling Script brianmu High Level Programming 1 09-06-2001 07:15 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-15-2008
Peejay's Avatar
Registered User
 

Join Date: Jul 2008
Posts: 3
Polling an FTP site for a file

Hi,

I'm after a bit of advice for the best way to collect files from an ftp server via a unix process. The main issue here is the frequency, the job needs to check for files every minute or so between 8am and 8pm and pull them down to the box if there is anything there.

Originally the transfer was going to be done via a VPN tunnel direct to a directory on my machine which my batch job would poll, but life is never simple. Unfortunately, that has now fallen through and the files are now being placed on an ftp site instead and I have to pull the files from there as security will not allow a push from there when a file is deposited on it, which also would have made life easier.

My question is, is there a way of opening a connection to the ftp site and keeping it open to poll for a file for that long, or am I just going to have to open and close connections repeatedly throughout the day?

Is there a better way?

Cheers
Paul.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-15-2008
Registered User
 

Join Date: Sep 2007
Location: Koblenz, Germany
Posts: 579
Writing a little here-script that checks every minute in the time window you said might be a proper solution. Keeping the connection open without doing anything might kick you out anyway, depending on how the ftp server is configured.
Reply With Quote
  #3 (permalink)  
Old 07-15-2008
Peejay's Avatar
Registered User
 

Join Date: Jul 2008
Posts: 3
Thanks for the reply.

That's sort of what I was thinking, a little process to connect up and check and then if found kick of the main shell. Just concerned with opening and closing a connection that often, after all that would mean 720 connections to the FTP during the space of a day from my process alone, let alone with the external companies dropping files on there. I'm just not overly keen on that. Then again I could just be being a little precious about it
Reply With Quote
  #4 (permalink)  
Old 07-15-2008
Registered User
 

Join Date: Sep 2007
Location: Koblenz, Germany
Posts: 579
If you have to check it every minute, that is ok, I think. FTP servers usually can stand a lot more of traffic and parallel connections, not sure what hardware, bandwith etc. you are using. I would set it up, let it run and if the admin of the FTP server sees any problems, I guess he will contact you
Reply With Quote
  #5 (permalink)  
Old 07-15-2008
Peejay's Avatar
Registered User
 

Join Date: Jul 2008
Posts: 3
Hehehe, many thanks for all the input, very much appreciated

I've just started coding a little process that once called will loop through all day check the FTP and then if returns a success kick off the main shell. I'm going to run some intensive testing this afternoon and see if the network admins complain about it or not. If not then I am in business

Many thanks again

Just a thought, could you seen any validity in adding the machine ident, username/password into the .netrc file? That's not going to make a whole heap of difference is it apart from tidy things up a little.
Reply With Quote
  #6 (permalink)  
Old 07-15-2008
jhtrice's Avatar
Registered User
 

Join Date: Jun 2008
Posts: 63
I'd use the .netrc. It makes keeping the password hidden a little easier.
Reply With Quote
  #7 (permalink)  
Old 07-15-2008
Registered User
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 232
I like expect but the mentioned options are easier. The benefits with expect are that you can build a loggable interface and get a lot of debugging information, notification and control that are impossible otherwise.
Reply With Quote
Google UNIX.COM
Reply

Tags
ftp

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0