Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/winetest.cron | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/winetest/winetest.cron b/winetest/winetest.cron index 611901380..df27116a3 100755 --- a/winetest/winetest.cron +++ b/winetest/winetest.cron @@ -17,6 +17,12 @@ # Cron job for generating winetest reports. Use it like # */5 * * * * winetest.cron WORKDIR
+# Leave empty to disable the corresponding task +build_compress=120 # days before compressing old-data builds +winetest_expire=120 # days before deleting winetest binaries +queue_expire=30 # days before deleting queued reports + + name0=`basename "$0"` tools=`dirname "$0"` case "$tools" in @@ -36,9 +42,6 @@ cleanup() rm -f "$lock" }
-# expiration age (in days) before results get archived -expire=120 - if [ ! -f "$lock" ] then touch "$lock" @@ -69,27 +72,34 @@ then [ -n "$refresh_index" ] && "$tools/build-index" [ -n "$refresh_errors" ] && "$tools/build-errors"
- # archive old results - ( + # compress old build reports + if [ -n "$build_compress" ] + then ( set -e cd old-data - dir=`find . -maxdepth 1 -mtime "+$expire" -type d -print -quit` + dir=`find . -maxdepth 1 -mtime "+$build_compress" -type d -print -quit` test -n "$dir" tar cfj "$dir.tar.bz2" "$dir" touch -r "$dir" "$dir.tar.bz2" rm -rf "$dir" - ) + fi )
- # remove old test builds - ( + # remove old winetest binaries + if [ -n "$winetest_expire" ] + then ( set -e mkdir -p builds cd builds - find . -mtime "+$expire" -name "winetest*.exe" -print0 | \ + find . -mtime "+$winetest_expire" -name "winetest*.exe" -print0 | \ xargs -0 rm -f - ) + fi )
- # remove old queue files - find queue -maxdepth 1 -mtime +30 -name "err*" -print0 | xargs -0 rm -rf - find queue -maxdepth 1 -mtime +30 -name "CGI*" -print0 | xargs -0 rm -f + # remove old queued files + if [ -n "$queue_expire" ] + then + find queue -maxdepth 1 -mtime +$queue_expire -name "err*" -print0 | \ + xargs -0 rm -rf + find queue -maxdepth 1 -mtime +$queue_expire -name "CGI*" -print0 | \ + xargs -0 rm -f + fi fi
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Why are we keeping the old results forever? This results in a pretty high disk usage on winehq:
data 27GB old-data/<dirs> 18GB old-data/*.bz2 62GB with the oldest build being from 2007
On my server I intend to use something like this: build_compress=60 build_expire=90
Actually we may as well compress the files directly in build-index while moving them to old-data. --- winetest/winetest.cron | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/winetest/winetest.cron b/winetest/winetest.cron index df27116a3..d7f0344e2 100755 --- a/winetest/winetest.cron +++ b/winetest/winetest.cron @@ -19,6 +19,7 @@
# Leave empty to disable the corresponding task build_compress=120 # days before compressing old-data builds +build_expire= # days before deleting old-data builds winetest_expire=120 # days before deleting winetest binaries queue_expire=30 # days before deleting queued reports
@@ -84,6 +85,15 @@ then rm -rf "$dir" fi )
+ # remove old build reports + if [ -n "$build_expire" ] + then ( + set -e + cd old-data + find . -mtime "+$build_expire" -name "*.tar.*" -print0 | \ + xargs -0 rm -f + fi ) + # remove old winetest binaries if [ -n "$winetest_expire" ] then (