lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject snapinstaller safety
Date Wed, 20 Jun 2007 14:23:28 GMT

Looking at src/scripts/snapinstaller more closely, I saw this block of code:

# install using hard links into temporary directory
# remove original index and then atomically copy new one into place
logMessage installing snapshot ${name}
cp -lr ${name}/ ${data_dir}/index.tmp$$
/bin/rm -rf ${data_dir}/index
mv -f ${data_dir}/index.tmp$$ ${data_dir}/index

Is there a technical reason why this wasn't written as:

logMessage installing snapshot ${name}

cp -lr ${name}/ ${data_dir}/index.tmp$$ && \

/bin/rm -rf ${data_dir}/index && \

mv -f ${data_dir}/index.tmp$$ ${data_dir}/index

This feels a little safer to me - I'd hate to have the main index rm -rf-ed if the cp -lr
command failed for some reason (e.g. disk full), but maybe Bill Au & Co. have a good reason
for not using &&'s.  There may be other places in various scripts that this might
be applicable to, but this is the first place I saw the extra safety possibility.


View raw message