aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/scheduler.pp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/buildsystem/manifests/scheduler.pp')
-rw-r--r--modules/buildsystem/manifests/scheduler.pp41
1 files changed, 13 insertions, 28 deletions
diff --git a/modules/buildsystem/manifests/scheduler.pp b/modules/buildsystem/manifests/scheduler.pp
index 11780312..5218b646 100644
--- a/modules/buildsystem/manifests/scheduler.pp
+++ b/modules/buildsystem/manifests/scheduler.pp
@@ -24,47 +24,32 @@ class buildsystem::scheduler {
minute => '*',
}
- if ($buildsystem::var::scheduler::clean_uploads_logs_age != '0') {
-# tidy { "${buildsystem::var::scheduler::homedir}/uploads":
-# type => 'ctime',
-# recurse => true,
-# age => $buildsystem::var::scheduler::clean_uploads_logs_age,
-# rmdirs => true,
-# }
-
+ if ($buildsystem::var::scheduler::clean_uploads_logs_age != 0) {
cron { 'clean uploads logs':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -ctime +14 >/var/lib/schedbot/clean-uploads-logs-test.log 2>&1", shellquote($homedir)),
+ # Delete old upload logs
+ command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -ctime +%d >/var/lib/schedbot/clean-uploads-logs-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)),
hour => '*/1',
minute => '51',
}
cron { 'clean uploads dirs':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- # Remove old empty directories. This will take several passes over
- # several weeks to delete a directory hierarchy because it is looking
- # at ctime instead of mtime, which resets every time a file/directory
- # underneath it is deleted. Directories don't take much space, so this
- # shouldn't be a real issue.
- command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -mindepth 5 -xdev -depth -type d -ctime +14 -empty >/var/lib/schedbot/clean-uploads-dirs-test.log 2>&1", shellquote($homedir)),
+ # Remove old empty uploads directories. This will take several
+ # passes (over several weeks) to delete a directory hierarchy
+ # because it is looking at ctime instead of mtime, which resets
+ # every time a file/directory underneath it is deleted.
+ # Directories don't take much space, so this shouldn't be a
+ # real issue.
+ command => sprintf("/usr/bin/find %s/uploads -ignore_readdir_race -mindepth 5 -xdev -depth -type d -ctime +%d -empty >/var/lib/schedbot/clean-uploads-dirs-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_logs_age)),
hour => '*/1',
minute => '53',
}
}
- if ($buildsystem::var::scheduler::clean_uploads_packages_age != '0') {
-# tidy { "${buildsystem::var::scheduler::homedir}/uploads/**/*.rpm":
-# path => "${buildsystem::var::scheduler::homedir}/uploads",
-# type => 'ctime',
-# recurse => true,
-# age => $buildsystem::var::scheduler::clean_uploads_packages_age,
-# matches => [ '*.rpm' ],
-# }
-
+ if ($buildsystem::var::scheduler::clean_uploads_packages_age != 0) {
cron { 'clean uploads packages':
user => $login,
- # TEMPORARY to test what will be deleted before replacing the above
- command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -name '*.rpm' -ctime +7 >/var/lib/schedbot/clean-uploads-packages-test.log 2>&1", shellquote($homedir)),
+ # Delete old upload RPMs
+ command => sprintf("/usr/bin/find %s/uploads -xdev -depth -type f -name '*.rpm' -ctime +%d >/var/lib/schedbot/clean-uploads-packages-test.log 2>&1", shellquote($homedir), shellquote($buildsystem::var::scheduler::clean_uploads_packages_age)),
hour => '*/1',
minute => '52',
}