<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
how about sending a "upload-completed"&nbsp; file just after sending the
data file. The processing cron job would first look for the presence of
the "upload-completed"&nbsp; file before beginning the processing.&nbsp;
Remove the "upload-completed"&nbsp; file during the processing procedure.
<br>&nbsp;
<br>&nbsp;
<p>"Alek O. Komarnitsky (N-CSC)" wrote:
<blockquote TYPE=CITE>> From co-sage-admin@fpcc.net Tue Jan 13 09:51 MST
2004
<br>> From: Nate Duehr &lt;nate@natetech.com>
<br>>
<br>> [Sorry about the cross-post for those on all the lists, just attempting
to
<br>> cover a wider audience.]
<br>>
<br>> Here's an interesting one, or maybe I'm just not creative enough
today.&nbsp; I
<br>> have a Linux server where people upload some files to me for processing
<br>> (using sftp).&nbsp; The files show up, I move them to another machine
to do
<br>> the dirty work.&nbsp; Simple, right?&nbsp; Move those files elsewhere
after they
<br>> arrive, which can pretty easily be done from a cron job, no problem
<br>> there.
<br>>
<br>> The case I'm wondering about: How to detect in that regular cron
job if
<br>> the file is open (and probably growing) right at the time because
it's
<br>> being uploaded right then... so the cron doesn't attempt to move
it to
<br>> the other machine in the middle of an upload.
<br>>
<br>> I'm thinking some silly hack at the top of the "move to other machine"
<br>> script that would look at the directory contents with lsof to make
sure
<br>> nothing has any of the files to be moved already open.&nbsp; Is there
a
<br>> simpler/smarter way?
<p>Here's some quick ideas for hacks:
<br>&nbsp;&nbsp; 1.&nbsp; If it's not time critical, look at the modify
time.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If withen the last minute, skip
it ... and then have it
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; picked up in the cron run.
<p>&nbsp;&nbsp; 2.&nbsp; Do a stat to get file size, then sleep for 5 seconds,
and do a
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stat again ... if file size has
changed, skip it.
<br>&nbsp;
<p>alek
<p>P.S. FYI FWIW: I got some Emails from folks on this list who enjoyed
<br>&nbsp;&nbsp;&nbsp;&nbsp; my Christmas Lights/Webcam - the final wrapup
has been done - see:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.komar.org/xmas/">http://www.komar.org/xmas/</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp; Click on the 2003 link and then stats for
those interested in
<br>&nbsp;&nbsp;&nbsp;&nbsp; that type of stuff - also includes an analysis
of the Slashdot Effect
<br>&nbsp;&nbsp;&nbsp;&nbsp; on Christmas Lights. There's a 2004/what's-new
link from the top-level;
<br>&nbsp;&nbsp;&nbsp;&nbsp; this is a pretty technical/astute crowd, so
any ideas appreciated.
<br>-
<br>This is the CO-SAGE Mailing list.&nbsp; Please don't post attachments,
<br>binaries or excessively long posts.&nbsp; To unsubscribe, please visit
<br><a href="http://lists.fpcc.net/mailman/listinfo/co-sage">http://lists.fpcc.net/mailman/listinfo/co-sage</a></blockquote>

<pre>--&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _______________________________________________________
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Steve Sayler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |US Gov't, Department of Commerce,&nbsp;&nbsp; Tel: 303-497-3959&nbsp; |
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |NOAA, Space Environment Center&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax: 303-497-3645&nbsp; |
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ |325 Broadway, MS: R/E/SE2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | _
&nbsp;&nbsp;&nbsp;&nbsp; / )|Boulder, Colorado, USA 80303&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |( \
&nbsp;&nbsp;&nbsp; / / |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | \ \
&nbsp; _( (_ |&nbsp; _&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email: steve.sayler@noaa.gov&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _&nbsp; | _) )_
&nbsp;(((\ \>|_/ >_______________________________________________&lt; \_|&lt;/ /)))
&nbsp;(\\\\ \_/ /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \ \_/ ////)
&nbsp; \&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp; _ __&nbsp;&nbsp; ___&nbsp;&nbsp; __ _&nbsp; __ _&nbsp;&nbsp; / /__&nbsp; ___&nbsp; ___&nbsp;&nbsp;&nbsp;&nbsp; \&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /
&nbsp;&nbsp; \&nbsp;&nbsp;&nbsp; _/&nbsp;&nbsp;&nbsp;&nbsp; | '_ \ / _ \ / _` |/ _` | / / __|/ _ \/ __|&nbsp;&nbsp;&nbsp;&nbsp; \_&nbsp;&nbsp;&nbsp; /
&nbsp;&nbsp; /&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | | | | (_) | (_| | (_| |/ /\__ \&nbsp; __/ (__&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |_| |_|\___/ \__,_|\__,_/_/ |___/\___|\___|</pre>
&nbsp;</html>