[FASTCGI] Kill fastcgi process

Matt fastcgi-developers at wilber.pointclark.net
Thu Jul 30 18:52:59 EDT 2009


Matthew writes...
["Matt wrote:
> "Bryan White" writes...
> ["When I have a new version is install by just moving the new version
> into place.  Note, a 'mv' is atomic.  A 'cp' could cause all sorts of
> problems."]
> So is it better than to use mv to overwrite a file then to use cp to overwrite the file? Whats the difference? What is the
shell/OS
> doing different for a move Vs a copy?

It depends, actually.  If I recall correctly, within a single
filesystem, 'mv' is - internally - just renaming the file.  On the other
hand, 'cp' creates a new file, and then copies the data from the
original file to the new file.  Crossing filesystem boundaries, mv
behaves the same as cp, except that it deletes the source file afteward.

When you need to cross filesystem boundaries (typical filesystems are /,
/usr, /home, /var, /tmp - but this really varies quite a bit), it is
better to cp the file to some temporary file within the target
filesystem, and then mv it to its final destination."]
================================================

Let's see if I have this correct. cp is doing some like:
ofstream fout;
fout.open("somefile.txt");
fout.write(data, length);
fout.close();

While mv is just manipulating the file system tables?

So if some other process had somefile.txt open for input and was still reading from it, a cp would interrupt that process but an mv
would allow that process to finish?


More information about the FastCGI-developers mailing list