install.sh: reduce nonfunctional update window
commit3c69b21e26b646b2f4727a245c4c49f6d66db960
authorKyle J. McKay <mackyle@gmail.com>
Mon, 21 Nov 2016 04:18:17 +0000 (20 20:18 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 21 Nov 2016 04:18:17 +0000 (20 20:18 -0800)
tree791e91733704fcfdb2835760d1d2f3779b2734c2
parent18c9c9023114c4344a62dd9f96b09b9028f63b74
install.sh: reduce nonfunctional update window

When renaming dir to dir-old and then dir-new to dir there's a small
window of opportunity after the rename of dir to dir-old before the
rename of dir-new to dir completes during which things will be possibly
be nonfunctional.

Rather than using two separate "mv" invocations in the shell, use two
rename calls in a Perl script.  By using Perl there's guaranteed to be
only the one process involved and the two calls should happen with
practically no delay between them thus reducing the window of
opportunity to practically its smallest possible size.

Until an atomic directory rename/exchange comes along this is probably
the best that can be done short of changing things to use a symbolic
link in the directory path somewhere which can be atomically replaced.

Since some web servers go to great lengths to avoid following symbolic
links such a change would likely impact web server configuration too.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
install.sh