blob: bfe521bbf485aa5b54ade8ee5059d16133d38119 [file] [log] [blame]
david_williamse5298172007-12-20 03:30:54 +00001#!/bin/sh
2
3
4# remember to leave no slashes on filename in source command,
5# (the commonVariations.shsource file, that is)
6# so that users path is used to find it (first)
7if [ -n $BUILD_INITIALIZED ]
8then
9 source commonVariations.shsource
10 source ${BUILD_HOME}/releng.control/commonComputedVariables.shsource
11fi
12
13# remove artifacts over n days old
14# (where hours = 24 + (n * 24), basically, so that
15# even n=0 means "1 day")
16
david_williamse0f67a32007-12-20 03:39:17 +000017# set at 10 days, under assumption that before that time,
18# artifacts will be "saved" elsewhere, if needed.
david_williamsfd4706f2007-12-20 03:40:47 +000019# if more cleanup is needed, we should take time, and
20# existence of more recent builds into account, so we never
21# delete the last existing build (even if "old").
david_williamse0f67a32007-12-20 03:39:17 +000022n=10;
david_williamse5298172007-12-20 03:30:54 +000023
24echo " Removing artifact directories older than $n days";
25echo " number of directories before cleaning: ";
david_williams50cfbbf2007-12-20 03:36:19 +000026find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 | wc -l
david_williamse5298172007-12-20 03:30:54 +000027
david_williams50cfbbf2007-12-20 03:36:19 +000028find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 -ctime +$n -exec rm -fr '{}' \;
david_williamse5298172007-12-20 03:30:54 +000029
30echo " number of directories after cleaning: ";
david_williams50cfbbf2007-12-20 03:36:19 +000031find ${BUILD_HOME}/artifacts -mindepth 2 -maxdepth 2 | wc -l