summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config5
-rwxr-xr-xcron-jobs/ftpdir-cleanup8
-rwxr-xr-xcron-jobs/sourceballs9
3 files changed, 22 insertions, 0 deletions
diff --git a/config b/config
index ff297ec..f1ef098 100644
--- a/config
+++ b/config
@@ -6,8 +6,13 @@ SRCPOOL=''
CLEANUP_DESTDIR="/srv/package-cleanup"
CLEANUP_DRYRUN=false
+# Time in days to keep moved packages
+CLEANUP_KEEP=60
+
SOURCE_CLEANUP_DESTDIR="/srv/source-cleanup"
SOURCE_CLEANUP_DRYRUN=false
+# Time in days to keep moved sourcepackages
+SOURCE_CLEANUP_KEEP=14
LOCK_DELAY=10
LOCK_TIMEOUT=300
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index fe49706..bd2d340 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -95,6 +95,14 @@ for repo in ${PKGREPOS[@]}; do
fi
done
+old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -mtime +${CLEANUP_KEEP} -printf '%f\n'))
+if [ ${#old_pkgs[@]} -ge 1 ]; then
+ msg "Removing old packages from the cleanup directory..."
+ for old_pkg in ${old_pkgs[@]}; do
+ msg2 "${old_pkg}"
+ ${CLEANUP_DRYRUN} || rm -f "${CLEANUP_DESTDIR}/${old_pkg}"
+ done
+fi
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 85221a7..4048e2f 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -132,4 +132,13 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
fi
+old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n'))
+if [ ${#old_pkgs[@]} -ge 1 ]; then
+ msg "Removing old source packages from the cleanup directory..."
+ for old_pkg in ${old_pkgs[@]}; do
+ msg2 "${old_pkg}"
+ ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
+ done
+fi
+
script_unlock