blob: bfe521bbf485aa5b54ade8ee5059d16133d38119 [file] [log] [blame]
#!/bin/sh
# remember to leave no slashes on filename in source command,
# (the commonVariations.shsource file, that is)
# so that users path is used to find it (first)
if [ -n $BUILD_INITIALIZED ]
then
source commonVariations.shsource
source ${BUILD_HOME}/releng.control/commonComputedVariables.shsource
fi
# remove artifacts over n days old
# (where hours = 24 + (n * 24), basically, so that
# even n=0 means "1 day")
# set at 10 days, under assumption that before that time,
# artifacts will be "saved" elsewhere, if needed.
# if more cleanup is needed, we should take time, and
# existence of more recent builds into account, so we never
# delete the last existing build (even if "old").
n=10;
echo " Removing artifact directories older than $n days";
echo " number of directories before cleaning: ";
find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 | wc -l
find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 -ctime +$n -exec rm -fr '{}' \;
echo " number of directories after cleaning: ";
find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 | wc -l