avoid recursive find, test for maxdepth support, filter snapshot names on master: SOLR-207

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@529471 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2007-04-17 02:25:28 +00:00
parent 0cf8721a40
commit db21821167
5 changed files with 27 additions and 4 deletions

View File

@ -218,6 +218,11 @@ Bug Fixes
10. SOLR-198: RunExecutableListener always waited for the process to
finish, even when wait="false" was set. (Koji Sekiguchi via yonik)
11. SOLR-207: Changed distribution scripts to remove recursive find
and avoid use of "find -maxdepth" on platforms where it is not
supported. (yonik)
Other Changes
1. Updated to Lucene 2.1

View File

@ -105,8 +105,16 @@ trap 'echo "caught INT/TERM, exiting now but partial cleanup may have already oc
if [[ -n ${days} ]]
then
#is maxdepth supported?
find ${data_dir} -maxdepth 0 -name foobar >/dev/null 2>&1
if [ $? = 0 ]; then
maxdepth="-maxdepth 1"
else
unset maxdepth
fi
logMessage cleaning up backups more than ${days} days old
for i in `find ${data_dir} -name "backup.*" -maxdepth 1 -mtime +${days} -print`
for i in `find ${data_dir} ${maxdepth} -name 'backup.*' -mtime +${days} -print`
do
remove $i
done

View File

@ -111,8 +111,16 @@ trap 'echo "caught INT/TERM, exiting now but partial cleanup may have already oc
if [[ -n ${days} ]]
then
#is maxdepth supported?
find ${data_dir} -maxdepth 0 -name foobar >/dev/null 2>&1
if [ $? = 0 ]; then
maxdepth="-maxdepth 1"
else
unset maxdepth
fi
logMessage cleaning up snapshots more than ${days} days old
for i in `find ${data_dir} -name "snapshot.*" -maxdepth 1 -mtime +${days} -print`
for i in `find ${data_dir} ${maxdepth} -name 'snapshot.*' -mtime +${days} -print`
do
remove $i
done

View File

@ -110,7 +110,7 @@ logMessage started by $oldwhoami
logMessage command: $0 $@
# get directory name of latest snapshot
name=`find ${data_dir} -name snapshot.* -print|grep -v wip|sort -r|head -1`
name=`ls ${data_dir}|grep 'snapshot\.'|grep -v wip|sort -r|head -1`
# clean up after INT/TERM
trap 'echo "caught INT/TERM, exiting now but partial installation may have already occured";/bin/rm -rf ${data_dir"/index.tmp$$;logExit aborted 13' INT TERM
@ -122,6 +122,8 @@ then
logExit ended 0
fi
name=${data_dir}/${name}
# has snapshot already been installed
if [[ ${name} == `cat ${solr_root}/logs/snapshot.current 2>/dev/null` ]]
then

View File

@ -178,7 +178,7 @@ fi
# get directory name of latest snapshot if not specified on command line
if [[ -z ${snap_name} ]]
then
snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} "find ${master_data_dir} -name snapshot.\* -print"|grep -v wip|sort -r|head -1`
snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} "ls ${master_data_dir}|grep 'snapshot\.'|grep -v wip|sort -r|head -1"`
fi
if [[ "${snap_name}" == "" ]]
then