<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
how about sending a "upload-completed" file just after sending the
data file. The processing cron job would first look for the presence of
the "upload-completed" file before beginning the processing.
Remove the "upload-completed" file during the processing procedure.
<br>
<br>
<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 <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. I
<br>> have a Linux server where people upload some files to me for processing
<br>> (using sftp). The files show up, I move them to another machine
to do
<br>> the dirty work. Simple, right? 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. Is there
a
<br>> simpler/smarter way?
<p>Here's some quick ideas for hacks:
<br> 1. If it's not time critical, look at the modify
time.
<br> If withen the last minute, skip
it ... and then have it
<br> picked up in the cron run.
<p> 2. Do a stat to get file size, then sleep for 5 seconds,
and do a
<br> stat again ... if file size has
changed, skip it.
<br>
<p>alek
<p>P.S. FYI FWIW: I got some Emails from folks on this list who enjoyed
<br> my Christmas Lights/Webcam - the final wrapup
has been done - see:
<br> <a href="http://www.komar.org/xmas/">http://www.komar.org/xmas/</a>
<br> Click on the 2003 link and then stats for
those interested in
<br> that type of stuff - also includes an analysis
of the Slashdot Effect
<br> on Christmas Lights. There's a 2004/what's-new
link from the top-level;
<br> this is a pretty technical/astute crowd, so
any ideas appreciated.
<br>-
<br>This is the CO-SAGE Mailing list. Please don't post attachments,
<br>binaries or excessively long posts. 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>--
_______________________________________________________
| Steve Sayler |
|US Gov't, Department of Commerce, Tel: 303-497-3959 |
|NOAA, Space Environment Center Fax: 303-497-3645 |
_ |325 Broadway, MS: R/E/SE2 | _
/ )|Boulder, Colorado, USA 80303 |( \
/ / | | \ \
_( (_ | _ email: steve.sayler@noaa.gov _ | _) )_
(((\ \>|_/ >_______________________________________________< \_|</ /)))
(\\\\ \_/ / __ \ \_/ ////)
\ / _ __ ___ __ _ __ _ / /__ ___ ___ \ /
\ _/ | '_ \ / _ \ / _` |/ _` | / / __|/ _ \/ __| \_ /
/ / | | | | (_) | (_| | (_| |/ /\__ \ __/ (__ \ \
|_| |_|\___/ \__,_|\__,_/_/ |___/\___|\___|</pre>
</html>