Skip to content
Snippets Groups Projects
Commit aae11dc6 authored by david_williams's avatar david_williams
Browse files

cleanup more during daily cleanup

parent 508036cc
No related branches found
No related tags found
No related merge requests found
...@@ -73,13 +73,12 @@ echo; ...@@ -73,13 +73,12 @@ echo;
# requires parent Directiory as first argument # requires parent Directiory as first argument
# if nDays not specified as second argument, then 0 is assumed # if nDays not specified as second argument, then 0 is assumed
# (which is one day) # (which is one day)
# if "saveAtLeast" is not set, as third argument, then assumed to be 1
# (that is, at least "saveAtLeast" directories will be saved, no matter how old)
function removeOldDirectories () { function removeOldDirectories () {
parentDir=$1; parentDir=$1;
ndays=$2; ndays=$2;
saveAtLeast=$3;
if [ -z $parentDir ] if [ -z $parentDir ]
then then
...@@ -95,13 +94,6 @@ else ...@@ -95,13 +94,6 @@ else
echo "INFO: ndays set to $ndays"; echo "INFO: ndays set to $ndays";
fi fi
if [ -z saveAtLeast ]
then
echo "INFO: saveAtLeast not specified, 1 assumed";
saveAtLeast=0
else
echo "INFO: saveAtLeast set to $saveAtLeast";
fi
echo; echo;
echo " Removing directories older than ${ndays} days"; echo " Removing directories older than ${ndays} days";
...@@ -110,9 +102,9 @@ before=`find ${parentDir} -mindepth 1 -maxdepth 1 | wc -l`; ...@@ -110,9 +102,9 @@ before=`find ${parentDir} -mindepth 1 -maxdepth 1 | wc -l`;
echo " number of directories before cleaning: ${before}"; echo " number of directories before cleaning: ${before}";
# empty directories often result from "bad builds". We remove those no matter how old # empty directories often result from "bad builds". We remove those no matter how old
find ${parentDir} -mindepth 1 -maxdepth 1 -type d -empty -exec rm -fr '{}' \; find ${parentDir} -mindepth 1 -maxdepth 2 -type d -empty -exec rm -fr '{}' \;
# now remove old ones # now remove old ones
find ${parentDir} -mindepth 1 -maxdepth 1 -type d -ctime +$ndays -execdir ${RELENG_CONTROL}/removeIf.sh '{}' \; find ${parentDir} -mindepth 1 -maxdepth 1 -type d -ctime +$ndays -exec ${RELENG_CONTROL}/removeIf.sh '{}' \;
after=`find ${parentDir} -mindepth 1 -maxdepth 1 | wc -l`; after=`find ${parentDir} -mindepth 1 -maxdepth 1 | wc -l`;
echo " number of directories after cleaning: ${after}"; echo " number of directories after cleaning: ${after}";
......
...@@ -42,7 +42,7 @@ fi ...@@ -42,7 +42,7 @@ fi
if [ -d $foundDirectory ] if [ -d $foundDirectory ]
then then
rm -fr $foundDirectory rm -fr $foundDirectory
echo " removed: $foundDirectory"; echo " removed: $foundDirectory";
else else
echo "ERROR: the foundDirectory, $foundDirectory, is not a directory" echo "ERROR: the foundDirectory, $foundDirectory, is not a directory"
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment