[tpm] more problems than solutions this week
indy at indigostar.com
Fri May 4 12:14:15 PDT 2012
While we are on this topic. One issue I have encountered is that of how to
update a 'live' file on a webserver. Lets say that we have a large file on
a webserver 'foo.tar' and I want to replace it with a new version. If I
SFTP upload a replacement file then I am never sure if I am going to mess up
someone that may be half way trough downloading the file.
I just verified that the inode number does not change if I upload a
replacement file with SFTP. Would I be correct in thinking that any file
downloads that are occurring concurrently with the upload would be
Would it be safe to upload the new file as 'new.tar' then use the commands
'rm foo.tar' followed by 'mv new.tar foo.tar'? On the assumption that the
rm command would only unlink the directory entry but any current file
handles being used to download the file would continue to work. Any new
downloads would use the new file.
IndigoSTAR Software -- www.indigostar.com
From: arocker at Vex.Net
Sent: Friday, May 04, 2012 2:44 PM
Subject: Re: [tpm] more problems than solutions this week
I see Indy's answered your problem, but just a point on the topic:
> But what I've found is that the inode doesn't change!
> [so I'd assume that the ">" redirection simply rewinds
> the write pointer to offset zero and writes the string
> and then truncates the file at that point.]
That's why "sort file > file" (and similar commands) is fatal; it resets
the pointer on the (output) file, then starts trying to read from the
(input) file, whose pointer now says it's at EOF.
toronto-pm mailing list
toronto-pm at pm.org
More information about the toronto-pm