aboutsummaryrefslogtreecommitdiff
path: root/cleaner.in
diff options
context:
space:
mode:
Diffstat (limited to 'cleaner.in')
-rwxr-xr-xcleaner.in15
1 files changed, 11 insertions, 4 deletions
diff --git a/cleaner.in b/cleaner.in
index 1d14fd4..0413943 100755
--- a/cleaner.in
+++ b/cleaner.in
@@ -56,7 +56,7 @@ thisweek=$(date +%U)
if [ $thisweek -gt $retainweeks ]; then
lastweek=$((thisweek - retainweeks))
else
- lastweek=$((thisweek + 53 - retainweeks))
+ lastweek=$((thisweek + 54 - retainweeks))
fi
$verbose \# removing from $dir files ending in $suffix and older than week $lastweek
@@ -70,8 +70,15 @@ fi |
do
$verbose \# considering $name
week=$(expr "$name" : '[^-][^-]*-\([0-9][0-9]*\)-.*')
- if [ $week -le $lastweek ]; then
- $verbose \# removing $name
- $dry_run rm $dir/$name
+ if [ $thisweek -ge $week ]; then
+ if [ $((thisweek - week)) -gt $retainweeks ]; then
+ $verbose \# removing $name
+ $dry_run rm $dir/$name
+ fi
+ else
+ if [ $((thisweek + 54 - week)) -gt $retainweeks ]; then
+ $verbose \# removing $name
+ $dry_run rm $dir/$name
+ fi
fi
done

Return to:

Send suggestions and report system problems to the System administrator.