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