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 > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

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 04:00 AM
AIX Site bakunin News, Links, Events and Announcements 0 12-05-2005 01:14 AM
Polling/Interrogate Directory Questions dnidiffer Shell Programming and Scripting 1 06-14-2005 09:20 PM
Help - Polling Script brianmu High Level Programming 1 09-06-2001 10:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-15-2008
Peejay's Avatar
Peejay Peejay is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 10
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.
  #2 (permalink)  
Old 07-15-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,257
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.
  #3 (permalink)  
Old 07-15-2008
Peejay's Avatar
Peejay Peejay is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 10
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
  #4 (permalink)  
Old 07-15-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,257
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
  #5 (permalink)  
Old 07-15-2008
Peejay's Avatar
Peejay Peejay is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 10
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.
  #6 (permalink)  
Old 07-15-2008
jhtrice's Avatar
jhtrice jhtrice is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 69
I'd use the .netrc. It makes keeping the password hidden a little easier.
  #7 (permalink)  
Old 07-15-2008
ramen_noodle ramen_noodle is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 251
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.
Sponsored Links
Closed Thread

Bookmarks

Tags
ftp

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 01:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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