From: Nikola Milutinovic <Nikola.Milutinovic@ev.co.yu>
Subject: Re: How to lock file from shell?
Date: 1999/03/03 [thread overview]
Message-ID: <36DCEDA2.C83DC94F@ev.co.yu> (raw)
In-Reply-To: slrn7dof6m.c52.ken@pulsar.halcyon.com
Ken Pizzini wrote:
>
> >Well, my problem is: how to detect that the file has been transferred?
> ...
> >The idea of testing a lock on the file, looked promissing, but I have to do it
> >from a shell script (zsh). "cp" doesn't care if the file is under a
> >lock/writing. I wouldn't want to implement any kind of "heuristic behavior" -
> >IF filesize unchanged for past 15 min THEN copy.
>
> 1. The best (IMO), if you have control over the client end, is to have
> the upload go to a tempfile, and then have the client do a REName
> of the tempfile to the final file name when the transfer has completed
> sucessfully.
I'll try this, but the clients in question are most likely Windows 95 based, FTP
Explorer, Rapid FTP, etc. I'll look into them if they have some scripting
available.
> 2. The next most promising is the heuristic approach you rejected above.
It's problematic, to say the least.
> 3. You could check, either via ps or some special mechanism offered by
> your particular ftpd, to see that there are no ftp connections active.
> Special care must be used to avoid race conditions, probably by
> playing games with inter-directory intra-filesystem mv commands.
Now, this could work. The script "locks on target" and then waits for all FTP
daemons to vanish. Of course, one "zombified" FTP would lock me down. Hmmm.
Stupid Digital FTP daemon clobers itself in "ps -A", gives me this: "-loca
(ftpd)". If I had the complete address... "netstat"? (sigh) It doesn't give the
whole FQDN, just a name without the domain. Then use "-n" and determine in
numeric form...
This pisses me off, which, in turn, tells me there must be an easier way.
> Only suggestion (1) above is robust (with appropriate controls
> on the client end for determining that "the transfer has
> completed successfully") against the possibility that a
> client might loose their initial ftp connection and then
> later complete the file transfer.
I'll see about (1). It really looks robust.
Nix.
next prev parent reply other threads:[~1999-03-03 5:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-02 5:00 How to lock file from shell? Nikola Milutinovic
1999-03-02 5:00 ` Joe Durusau
1999-03-03 5:00 ` Nikola Milutinovic
1999-03-03 5:00 ` Joe Durusau
1999-03-02 5:00 ` Yvonne & Oliver Maag
1999-03-03 5:00 ` Nikola Milutinovic
1999-03-02 5:00 ` Ken Pizzini
1999-03-03 5:00 ` Nikola Milutinovic [this message]
1999-03-04 5:00 ` Lars Hecking
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox