[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Archive queue/done in monthly cronjob



archive the directory from 2 months ago, leaving only the last
month accessible directly
---
 config/debian/monthly.functions | 6 ++++++
 config/debian/monthly.tasks     | 3 ++-
 config/debian/monthly.variables | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/config/debian/monthly.functions b/config/debian/monthly.functions
index 0241a96..db4de4b 100644
--- a/config/debian/monthly.functions
+++ b/config/debian/monthly.functions
@@ -16,4 +16,10 @@ function rotatequeued() {
     sudo -u dak-unpriv touch run/log
     xz -9 log.${OLDDATE}
     sudo -u dak-unpriv /srv/upload.debian.org/queued/debianqueued 2>/dev/null
+}
+
+function archivequeuedone() {
+    log "Archiving queue/done files of ${DONEYEAR}-${DONEMONTH}"
+    cd ${queuedir}/done/${DONEYEAR}
+    tar --create --xz --remove-files --file ${DONEMONTH}.tar.xz ${DONEMONTH}
 }
\ No newline at end of file
diff --git a/config/debian/monthly.tasks b/config/debian/monthly.tasks
index 619f58b..6973142 100644
--- a/config/debian/monthly.tasks
+++ b/config/debian/monthly.tasks
@@ -1,3 +1,4 @@
 # FUNC                 ARGS                       TIME                       ERR     BG
 rotatelog              none                       none                       false   true
-rotatequeued           none                       none                       false   true
\ No newline at end of file
+rotatequeued           none                       none                       false   true
+archivequeuedone       none                       none                       false   true
diff --git a/config/debian/monthly.variables b/config/debian/monthly.variables
index da3dd1b..5e1ea61 100644
--- a/config/debian/monthly.variables
+++ b/config/debian/monthly.variables
@@ -1,3 +1,6 @@
 # -*- mode:sh -*-
 DATE=$(date +%Y-%m)
 OLDDATE=$(date -d yesterday +%Y-%m)
+
+DONEYEAR=$(date -d '2 months ago' +%Y)
+DONEMONTH=$(date -d '2 months ago' +%m)
\ No newline at end of file
-- 
2.1.4


Reply to: