[lug] how to handle open files - upload server

Dave Treece davet at frii.com
Wed Jan 14 06:02:46 MST 2004


 One technique we use at work for transferring file is to either rename the
file after it's transferred or change the permissions on the file itself.
For example we might use ~file name during the transfer then move ~file to
file. Or, since most ftp transfers set the mode of the files to
read/read-write we'll chmod the file to set the exec bit: 755 or something.
Requires a little more work on your customers part, but, it sure beats
trying to find some "maybe/most-of-the-time" system command.

> -----Original Message-----
> From: lug-bounces at lug.boulder.co.us
> [mailto:lug-bounces at lug.boulder.co.us]On Behalf Of Nate Duehr
> Sent: Tuesday, January 13, 2004 9:50 AM
> To: clue-tech at clue.denver.co.us; lug at lug.boulder.co.us;
> discuss at co-sage.org
> Subject: [lug] how to handle open files - upload server
>
>
> [Sorry about the cross-post for those on all the lists, just
> attempting to
> cover a wider audience.]
>
> Here's an interesting one, or maybe I'm just not creative enough
> today.  I
> have a Linux server where people upload some files to me for processing
> (using sftp).  The files show up, I move them to another machine to do
> the dirty work.  Simple, right?  Move those files elsewhere after they
> arrive, which can pretty easily be done from a cron job, no problem
> there.
>
> The case I'm wondering about: How to detect in that regular cron job if
> the file is open (and probably growing) right at the time because it's
> being uploaded right then... so the cron doesn't attempt to move it to
> the other machine in the middle of an upload.
>
> I'm thinking some silly hack at the top of the "move to other machine"
> script that would look at the directory contents with lsof to make sure
> nothing has any of the files to be moved already open.  Is there a
> simpler/smarter way?
>
> (Off to go find some more coffee and think about this some more...)
>
> Bright ideas appreciated!  ;-)  (No, NFS mounting the other machine and
> having them send directly to it is not an option.  ;-) )
>
> --
> Nate Duehr, nate at natetech.com
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>




More information about the LUG mailing list