From aae11dc67a17798e42948f5536b6923f94bca623 Mon Sep 17 00:00:00 2001 From: david_williams <david_williams> Date: Sat, 12 Feb 2011 01:58:43 +0000 Subject: [PATCH] cleanup more during daily cleanup --- releng.control/cleanupArtifacts.sh | 16 ++++------------ releng.control/removeArtifactDirIf.sh | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/releng.control/cleanupArtifacts.sh b/releng.control/cleanupArtifacts.sh index 5eb4e2ce1..f48bf5cd6 100644 --- a/releng.control/cleanupArtifacts.sh +++ b/releng.control/cleanupArtifacts.sh @@ -73,13 +73,12 @@ echo; # requires parent Directiory as first argument # if nDays not specified as second argument, then 0 is assumed # (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 () { parentDir=$1; ndays=$2; -saveAtLeast=$3; + if [ -z $parentDir ] then @@ -95,13 +94,6 @@ else echo "INFO: ndays set to $ndays"; fi -if [ -z saveAtLeast ] -then - echo "INFO: saveAtLeast not specified, 1 assumed"; - saveAtLeast=0 -else - echo "INFO: saveAtLeast set to $saveAtLeast"; -fi echo; echo " Removing directories older than ${ndays} days"; @@ -110,9 +102,9 @@ before=`find ${parentDir} -mindepth 1 -maxdepth 1 | wc -l`; echo " number of directories before cleaning: ${before}"; # 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 -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`; echo " number of directories after cleaning: ${after}"; diff --git a/releng.control/removeArtifactDirIf.sh b/releng.control/removeArtifactDirIf.sh index f3870a11b..8bb597ed0 100644 --- a/releng.control/removeArtifactDirIf.sh +++ b/releng.control/removeArtifactDirIf.sh @@ -42,7 +42,7 @@ fi if [ -d $foundDirectory ] then rm -fr $foundDirectory - echo " removed: $foundDirectory"; + echo " removed: $foundDirectory"; else echo "ERROR: the foundDirectory, $foundDirectory, is not a directory" fi -- GitLab