Symlinking (ln) faster than moving (mv)?
Posted
by Chad Johnson
on Stack Overflow
See other posts from Stack Overflow
or by Chad Johnson
Published on 2010-03-26T18:44:54Z
Indexed on
2010/03/26
18:53 UTC
Read the original article
Hit count: 407
When we build web software releases, we prepare the release in a temporary directory and then replace the release directory with the temporary one just prepared:
# Move and replace existing release directory.
mv /path/to/httpdocs /path/to/httpdocs.before
mv /path/to/$newReleaseName /path/to/httpdocs
Under this scheme, it happens that with about 1 in every 15 releases, a user was using a file in the original release directory exactly at the time the commands above are run, and a fatal error occurs for that user.
I am wondering if using symlinking like follows would be significantly faster, in terms of processing time, thereby helping to lessen the likelihood of this problem:
# Remove and replace existing release symlink.
ln -sf /path/to/$newReleaseName path/to/httpdocs
© Stack Overflow or respective owner