summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-10-26 08:46:09 -0400
committerMalfurious <m@lfurio.us>2023-10-26 20:41:40 -0400
commit47dbaf2c1d6329fdc814a107e0020b5b23e2d237 (patch)
tree3caedee08d291080112ad1962832adfe463a92f6
parent618d4dac812c2d0ff46e4925cae4950f59bb02bf (diff)
downloadcychedelic-47dbaf2c1d6329fdc814a107e0020b5b23e2d237.tar.gz
cychedelic-47dbaf2c1d6329fdc814a107e0020b5b23e2d237.zip
acid: Prune old build logs during startup maintenance
Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-xacid/acid1
-rw-r--r--acid/config.sh3
2 files changed, 4 insertions, 0 deletions
diff --git a/acid/acid b/acid/acid
index c675fa1..49e8e72 100755
--- a/acid/acid
+++ b/acid/acid
@@ -92,6 +92,7 @@ sleep "$CYCHE_STARTUP_TIME"
remove
update --force
docker system prune --force --all
+find /logs -type f | sort -n | head -n "$((CYCHE_LOG_SIZE*-1))" | xargs rm -f
starttime=$(now)
# monitor source changes
diff --git a/acid/config.sh b/acid/config.sh
index ff44998..a25531e 100644
--- a/acid/config.sh
+++ b/acid/config.sh
@@ -10,6 +10,9 @@ CYCHE_JOB_TIME=10 # 10 seconds
# Minimum time to wait on daemon startup
CYCHE_STARTUP_TIME=60 # 1 minute
+# Maximum number of latest build logs to retain during cleanup
+CYCHE_LOG_SIZE=100
+
# Master list of managed services
CYCHE_SERVICES=(
# <ref-pattern> should be a string suitable for `git for-each-ref`. Some